Ejemplo n.º 1
0
        public Log4NetLogger(string className, string serverName, int?logLevel)
        {
            string name = "";

            if (serverName != null)
            {
                name       = serverName + "_" + className + "Appender";
                loggerName = serverName + "_" + className;
            }
            else
            {
                loggerName = className;
                name       = className + "Appender";
            }
            log4net.Appender.RollingFileAppender appender = Logger.GetAppenders(className, serverName);
            if (appender == null)
            {
                customAppender = new CustomFileAppender(className, serverName, logLevel);
            }
            log = log4net.LogManager.GetLogger(loggerName);
            //       log4net.ILog[] loggers = log4net.LogManager.GetCurrentLoggers();
            //  log4net.Config.XmlConfigurator.Configure();
            this.serverName = serverName;
            SetDefaultLogLevel();
            SetDefaultConversionPattern();
            if (logLevel != null)
            {
                SetLogLevel((int)logLevel);
            }
        }
Ejemplo n.º 2
0
 public void Reset(string className, string serverName)
 {
     loggerName = serverName + "_" + className;
     log4net.Appender.RollingFileAppender appender = Logger.GetAppenders(className, serverName);
     if (appender == null)
     {
         customAppender = new CustomFileAppender(className, serverName, overriderLevel);
     }
     log = log4net.LogManager.GetLogger(loggerName);
     SetDefaultLogLevel();
     SetDefaultConversionPattern();
     if (overriderLevel != defaultLevel)
     {
         SetLogLevel(overriderLevel);
     }
 }