Ejemplo n.º 1
0
        static GrgLogger()
        {
            //
            try
            {
                string strPath = AppDomain.CurrentDomain.BaseDirectory + @"Config\LogConfig.xml";
                s_LogFile = new LogFile3();
                bool bRet = s_LogFile.Open(strPath);
                if (!bRet)
                {
                    throw new Exception("GRGCbLog Error!");
                }

                s_showHex = true;

                XmlDocument doc = new XmlDocument();
                doc.Load(strPath);
                XmlAttribute attri = doc.DocumentElement.Attributes["showHex"];
                if (null != attri &&
                    !string.IsNullOrEmpty(attri.Value))
                {
                    int value = 0;
                    if (int.TryParse(attri.Value, out value))
                    {
                        s_showHex = value == 0 ? false : true;
                    }
                }
                doc.RemoveAll();
                doc = null;
            }
            catch (System.Exception ex)
            {
                Log4netWrapper.Create("root").Log("Failed to open the log file", emLogLevel.Fatal, ex);
                s_LogFile = null;
            }
        }
        public static MyLoggerWrapper Create(string name)
        {
            Debug.Assert(!string.IsNullOrEmpty(name));

            return(new MyLoggerWrapper(Log4netWrapper.Create(name)));
        }