示例#1
0
 /// <summary>
 /// 开启线程输出日志到文件
 /// </summary>
 private static void StartLog()
 {
     if (CanUseEventLog)
     {
         if (!EventLog.SourceExists(AppDomain.CurrentDomain.FriendlyName))
         {
             try
             {
                 EventLog.CreateEventSource(AppDomain.CurrentDomain.FriendlyName, Guid.NewGuid().ToString());
             }
             catch (SecurityException)
             {
                 throw;
             }
         }
         _log        = new EventLog(AppDomain.CurrentDomain.FriendlyName);
         _log.Source = AppDomain.CurrentDomain.FriendlyName;
     }
     ThreadUtil.RunLoop(new IntervalInfo()
     {
         Interval    = 100,
         ExecuteCode = WriteLogToFile
     }).Name = "Output log thread";
 }