Example #1
0
        private Logger()
        {
            LoggingQueue = new Queue <LogEntry>();
            config       = GetConfig.GetAllConfig();
            if (config.LoggerConfig == null)
            {
                throw new Exception("缺少Logger配置节");
            }

            if (System.Environment.CurrentDirectory + "\\" == AppDomain.CurrentDomain.BaseDirectory)
            {
                string stmp = Assembly.GetExecutingAssembly().Location;

                stmp     = stmp.Substring(0, stmp.LastIndexOf('\\'));//删除文件名
                filePath = stmp;
            }
            else
            {//web路径
                filePath = HttpRuntime.AppDomainAppPath;
            }
            filePath += "\\Log\\";
            CreateDirectory(filePath);
            logThread = new Thread(new ThreadStart(timerCallback));
            logThread.Start();
        }