Beispiel #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);
     }
 }
Beispiel #2
0
 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));
 }