示例#1
0
 static LogHelper()
 {
     //Configure log4net
     try
     {
         //If repository is already configured, skip this step.
         if (!LogManager.GetLoggerRepository(Assembly.GetExecutingAssembly()).Configured)
         {
             //Look in our assembly same folder or Machine.config'
             DOMConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "log4net.config")));
         }
     }
     catch (Exception e)
     {
         EventLogHelper.WriteLogEntry(e.Message, EventLogEntryType.Warning);
     }
 }
示例#2
0
文件: Log.cs 项目: windygu/.net-wms
 static Log()
 {
     if (File.Exists(Log4NetConfigFile))
     {
         if (Environment.OSVersion.Platform == PlatformID.Win32NT)
         {
             DOMConfigurator.ConfigureAndWatch(new FileInfo(Log4NetConfigFile));
         }
         else
         {
             DOMConfigurator.Configure(new FileInfo(Log4NetConfigFile));
         }
     }
     else
     {
         BasicConfigurator.Configure();
     }
     Logger = GetLogger(typeof(Log));
 }