/// <summary> /// Configures the log4net environment /// </summary> private void Setup(Level logLevel) { Directory.CreateDirectory(_logFolder); var hierarchy = (Hierarchy)LogManager.GetRepository(); var patternLayout = new PatternLayout("%date [%thread] %-5level - %message%newline"); patternLayout.ActivateOptions(); // Log to a file var roller = new RollingFileAppender(); roller.AppendToFile = false; roller.File = _logFile; roller.Layout = patternLayout; roller.MaxSizeRollBackups = 5; roller.RollingStyle = RollingFileAppender.RollingMode.Size; roller.StaticLogFileName = true; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); // Log to the visual studio console var appender = new TraceAppender(); appender.ActivateOptions(); appender.Layout = patternLayout; hierarchy.Root.AddAppender(appender); hierarchy.Root.Level = logLevel; hierarchy.Configured = true; }
static void InitializeLogger(string fileLocation, string loggerName = "DefaultLog.log") { var hierarchy = (Hierarchy)LogManager.GetRepository(); var tracer = new TraceAppender(); var patternLayout = new PatternLayout { ConversionPattern = LogPattern }; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); var roller = new RollingFileAppender { Layout = patternLayout, AppendToFile = true, RollingStyle = RollingFileAppender.RollingMode.Size, MaxSizeRollBackups = 4, MaximumFileSize = "10MB", StaticLogFileName = true, File = Path.Combine(GetLicenseFileFolder(fileLocation), loggerName) }; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.Debug; hierarchy.Configured = true; }
//currently, we just config log4net programmatically, but not by config file: public static void setLogFile(string file) { lock (s_logLock) { //log4net.Config.BasicConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure(); Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender tracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = "%d [%t] %-5p %m%n";; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); RollingFileAppender roller = new RollingFileAppender(); roller.Layout = patternLayout; roller.AppendToFile = true; roller.RollingStyle = RollingFileAppender.RollingMode.Size; roller.MaxSizeRollBackups = 10; roller.MaximumFileSize = "1MB"; roller.StaticLogFileName = true; roller.File = file; //"E:/temp/Log_TrendViewer.txt"; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; } }
/// <summary> /// Both parameters are simple filenames, not paths /// </summary> private static void ConfigureLogging(string loggingConfigFilename, string defaultLogFilename) { var hierarchy = (Hierarchy)LogManager.GetRepository(); hierarchy.Root.RemoveAllAppenders(); var loggingConfigFile = new FileInfo(loggingConfigFilename); if (loggingConfigFile.Exists) { XmlConfigurator.ConfigureAndWatch(loggingConfigFile); } else { ConfigureDefaultLogging(Path.Combine(TheProduct.LogPath, defaultLogFilename)); } #if DEBUG var consoleAppender = new TraceAppender { Layout = DefaultPatternLayout(false), Threshold = Level.All, ImmediateFlush = true }; consoleAppender.ActivateOptions(); BasicConfigurator.Configure(consoleAppender); #endif }
public static void Initialize(string logDir, string fileName, string category) { _logFile = System.IO.Path.Combine(logDir, fileName); Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender tracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = LOG_PATTERN; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); RollingFileAppender roller = new RollingFileAppender(); roller.Layout = patternLayout; roller.AppendToFile = true; roller.RollingStyle = RollingFileAppender.RollingMode.Size; roller.MaxSizeRollBackups = 4; roller.MaximumFileSize = "100KB"; roller.StaticLogFileName = true; roller.File = _logFile; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; _log = log4net.LogManager.GetLogger(category); }
public void MethodNameCategoryTest() { CategoryTraceListener categoryTraceListener = new CategoryTraceListener(); Trace.Listeners.Clear(); Trace.Listeners.Add(categoryTraceListener); ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString()); TraceAppender traceAppender = new TraceAppender(); PatternLayout methodLayout = new PatternLayout("%method"); methodLayout.ActivateOptions(); traceAppender.Category = methodLayout; traceAppender.Layout = new SimpleLayout(); traceAppender.ActivateOptions(); BasicConfigurator.Configure(rep, traceAppender); ILog log = LogManager.GetLogger(rep.Name, GetType()); log.Debug("Message"); Assert.AreEqual( System.Reflection.MethodInfo.GetCurrentMethod().Name, categoryTraceListener.Category); }
public DefaultLogWrapper(string logname, IConfig config) { this.logname = logname; Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); hierarchy.Clear(); TraceAppender tracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = "%t (%-5level) - %m%n"; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); RollingFileAppender roller = new RollingFileAppender(); roller.Layout = patternLayout; roller.AppendToFile = true; roller.RollingStyle = RollingFileAppender.RollingMode.Size; roller.MaxSizeRollBackups = 4; roller.MaximumFileSize = "100KB"; roller.StaticLogFileName = true; roller.File = Path.Combine(config.IndexFolder, "totalrecall-" + this.logname + ".log"); roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; }
static Logger() { Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender tracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = LOG_PATTERN; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); tracer.Name = "tracer1"; hierarchy.Root.AddAppender(tracer); FileAppender roller = new FileAppender(); roller.Layout = patternLayout; roller.AppendToFile = false; roller.File = "dnservices1.txt"; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; }
static Logger() { var hierarchy = (Hierarchy)LogManager.GetRepository(); var tracer = new TraceAppender(); var patternLayout = new PatternLayout { ConversionPattern = LOG_PATTERN }; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); var roller = new RollingFileAppender { Layout = patternLayout, AppendToFile = true, RollingStyle = RollingFileAppender.RollingMode.Size, MaxSizeRollBackups = 4, MaximumFileSize = "10240KB", StaticLogFileName = true, File = FilePath + @"\f1speed-log.txt" }; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.Debug; hierarchy.Configured = true; }
static void CreateAppender() { var layout = new PatternLayout("%.255message"); layout.ActivateOptions(); var appender = new InfluxAppender() { Name = "InfluxAppender", Host = "localhost" }; appender.ActivateOptions(); var diagAppender = new TraceAppender { Layout = layout, Name = "InfluxAppenderDiagLogger", }; diagAppender.ActivateOptions(); var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()); BasicConfigurator.Configure(logRepository, diagAppender); _appender = appender; _log = LogManager.GetLogger(typeof(InfluxAppender)); }
static Logger() { Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender tracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = LOG_PATTERN; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); RollingFileAppender roller = new RollingFileAppender(); roller.Layout = patternLayout; roller.AppendToFile = true; roller.RollingStyle = RollingFileAppender.RollingMode.Date; roller.MaxSizeRollBackups = 4; roller.MaximumFileSize = "100KB"; roller.StaticLogFileName = true; roller.File = "ftplog.log"; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; }
void CreateAppender() { var layout = new PatternLayout("%.255message"); layout.ActivateOptions(); var appender = new RemoteSyslog5424Appender("localhost", Port, @"Certificate\test.cer") { Layout = layout, AppName = typeof(RemoteSyslog5424AppenderTest).Name }; appender.ActivateOptions(); var diagAppender = new TraceAppender { Layout = layout, Name = "RemoteSyslog5424AppenderDiagLogger", }; diagAppender.ActivateOptions(); BasicConfigurator.Configure(diagAppender, appender); _appender = appender; _log = LogManager.GetLogger(typeof(RemoteSyslog5424AppenderTest)); }
public void DefaultCategoryTest() { CategoryTraceListener categoryTraceListener = new CategoryTraceListener(); Trace.Listeners.Clear(); Trace.Listeners.Add(categoryTraceListener); ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString()); TraceAppender traceAppender = new TraceAppender { Layout = new SimpleLayout() }; traceAppender.ActivateOptions(); BasicConfigurator.Configure(rep, traceAppender); ILog log = LogManager.GetLogger(rep.Name, GetType()); log.Debug("Message"); Assert.AreEqual( GetType().ToString(), categoryTraceListener.Category); }
public void Initialize(String Logpath, String Logname) { if (String.IsNullOrEmpty(Logpath)) { LogFilePath = Path.Combine(Path.Combine(ApplicationDocumentPath, LogFolder)); } else { LogFilePath = Path.Combine(Logpath, LogFolder); } ILoggerRepository repository = LogManager.GetRepository(); if (repository.Configured == true) { IAppender[] appenders = repository.GetAppenders(); foreach (IAppender appender in (from iAppender in appenders where iAppender is FileAppender select iAppender)) { FileAppender provisionfileAppender = appender as FileAppender; provisionfileAppender.File = Path.Combine(LogFilePath, Logname); provisionfileAppender.AppendToFile = true; provisionfileAppender.ActivateOptions(); } } else { LogFilePath = Path.Combine(LogFilePath, Logname); Hierarchy provisionhierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender provisiontracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = LOG_PATTERN; patternLayout.ActivateOptions(); provisiontracer.Layout = patternLayout; provisiontracer.ActivateOptions(); provisionhierarchy.Root.AddAppender(provisiontracer); RollingFileAppender provisionroller = new RollingFileAppender(); provisionroller.Layout = patternLayout; provisionroller.AppendToFile = true; provisionroller.RollingStyle = RollingFileAppender.RollingMode.Size; provisionroller.MaxSizeRollBackups = -1; provisionroller.MaximumFileSize = "4MB"; provisionroller.StaticLogFileName = true; provisionroller.File = LogFilePath; //provisionroller.PreserveLogFileNameExtension = true; provisionroller.ActivateOptions(); provisionhierarchy.Root.AddAppender(provisionroller); provisionhierarchy.Root.Level = Level.All; provisionhierarchy.Configured = true; } }
/// <summary> /// Configura o appender na console de desenvolvimento. /// </summary> /// <returns>Appender configurado.</returns> private AppenderSkeleton ConfigureTraceAppender(string pattern) { var trace = new TraceAppender(); trace.Layout = BuildPattern(pattern); trace.ImmediateFlush = true; trace.ActivateOptions(); return(trace); }
public static TraceAppender CreateTraceAppender() { var tracer = new TraceAppender { Layout = PatternLayout }; tracer.ActivateOptions(); PatternLayout.ActivateOptions(); return(tracer); }
public TraceAppender CreateTraceAppender(IFilter filter) { var tracer = new TraceAppender(); var patternLayout = CreatePatternLayout(LOG_PATTERN); tracer.Layout = patternLayout; tracer.AddFilter(filter); tracer.ActivateOptions(); return(tracer); }
public TestLogger() { _appender = new TraceAppender(); _appender.Name = "Test Logger"; var layout = new PatternLayout(); layout.ConversionPattern = "%d [%t] %-5p [%logger] - %m%n"; layout.ActivateOptions(); _appender.Layout = layout; _appender.ActivateOptions(); }
public AfterglowLogger(string applicationDataFolder, string loggingFile, int loggingLevel = LoggingLevels.LOG_LEVEL_ERROR) { string loggingPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), applicationDataFolder); if (!System.IO.Directory.Exists(loggingPath)) { System.IO.Directory.CreateDirectory(loggingPath); } loggingPath = System.IO.Path.Combine(loggingPath, Path.GetDirectoryName(loggingFile)); if (!System.IO.Directory.Exists(loggingPath)) { System.IO.Directory.CreateDirectory(loggingPath); } string logFilePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), applicationDataFolder, loggingFile); _layout.ConversionPattern = DefaultPattern; _layout.ActivateOptions(); _logger = LogManager.GetLogger(typeof(AfterglowLogger)); Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender tracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = LOG_PATTERN; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); RollingFileAppender roller = new RollingFileAppender(); roller.Layout = patternLayout; roller.AppendToFile = true; roller.RollingStyle = RollingFileAppender.RollingMode.Size; roller.LockingModel = new log4net.Appender.FileAppender.MinimalLock(); roller.MaxSizeRollBackups = 4; roller.MaximumFileSize = "100KB"; roller.StaticLogFileName = true; roller.File = logFilePath; roller.Name = "RollingFileAppender"; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); LoggingLevel = loggingLevel; hierarchy.Configured = true; }
private static TraceAppender CreateTraceLog(IFilter filter = null) { var layout = new PatternLayout(patternLayoutFormat); TraceAppender appender = new TraceAppender { Layout = layout }; appender.ActivateOptions(); if (filter != null) { appender.AddFilter(filter); } return(appender); }
public static void LoadTraceAppender() { TraceAppender appender = new TraceAppender(); appender.Name = "TraceAppender"; PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = _ConversionPattern; patternLayout.ActivateOptions(); appender.Layout = patternLayout; appender.ActivateOptions(); BasicConfigurator.Configure(appender); }
public static IAppender CreateTraceAppender() { TraceAppender appender = new TraceAppender() { Name = "TraceAppender" }; PatternLayout layout = new PatternLayout() { ConversionPattern = "%date [%thread] %-5level %logger - %message%newline" }; layout.ActivateOptions(); appender.Layout = layout; appender.ActivateOptions(); return(appender); }
/// <summary> /// Configures a trace appender for log4net so that log output /// is written to the test output. /// </summary> public static void ConfigureLoggingToTrace() { Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); hierarchy.Root.RemoveAllAppenders(); TraceAppender appender = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = "%d %-5p [%-10c] %m%n%n"; patternLayout.ActivateOptions(); appender.Layout = patternLayout; appender.ActivateOptions(); log4net.Config.BasicConfigurator.Configure(appender); }
internal static TraceAppender BuildTraceLog(ListeningLogOptions options) { var layout = new PatternLayout { ConversionPattern = options.Pattern }; layout.ActivateOptions(); var appender = new TraceAppender { Layout = layout, ImmediateFlush = options.ImmediateFlush }; appender.ActivateOptions(); return(appender); }
/// <summary> /// Sets up logging to files /// </summary> private static void SetupLogging() { var hierarchy = (Hierarchy)LogManager.GetRepository(typeof(Program).Assembly); var tracer = new TraceAppender(); var filter = new LevelMatchFilter(); var layout = new PatternLayout("%date{MMM/dd/yyyy HH:mm:ss,fff} [%thread] %-5level %logger %ndc – " + "%message%newline"); tracer.Layout = layout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); var roller = new RollingFileAppender { File = Path.Combine(Configuration["logs_directory"] ?? "Logs", $"{DateTime.Now.ToString(DateFormat)}.log"), ImmediateFlush = true, AppendToFile = true, StaticLogFileName = true, RollingStyle = RollingFileAppender.RollingMode.Once, LockingModel = new FileAppender.MinimalLock() }; roller.AddFilter(filter); roller.Layout = layout; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); var consoleAppender = new ConsoleAppender { Layout = layout }; consoleAppender.ActivateOptions(); hierarchy.Root.AddAppender(consoleAppender); Level assumedLevel = hierarchy.LevelMap[Configuration["log_level"] ?? "Info"]; hierarchy.Root.Level = assumedLevel ?? Level.Info; hierarchy.Configured = true; if (assumedLevel is null) { LogManager.GetLogger(typeof(Program)).Error("Unable to set log level. Will use INFO.", null); } }
public static void Initialize(TestContext ctx) { Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender tracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); tracer.ImmediateFlush = true; patternLayout.ConversionPattern = LOG_PATTERN; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; }
//public LoggingService(string filePathToSaveLog = "") static LoggingService() { string filePathToSaveLog = ""; PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = LogPattern; // patternLayout.Header = "[Header]\\r\\n"; // patternLayout.Footer = "[Footer]\\r\\n"; patternLayout.ActivateOptions(); TraceAppender tracer = new TraceAppender(); tracer.Layout = patternLayout; tracer.ActivateOptions(); Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); hierarchy.Root.AddAppender(tracer); RollingFileAppender roller = new RollingFileAppender(); //roller.LockingModel = roller.File = string.IsNullOrWhiteSpace(filePathToSaveLog) ? DefaultFilePath : filePathToSaveLog; //roller.AppendToFile = true; roller.DatePattern = ".yyyy-MM-dd.\\l\\o\\g"; //roller.RollingStyle = RollingFileAppender.RollingMode.Date; roller.RollingStyle = RollingFileAppender.RollingMode.Composite; roller.StaticLogFileName = false; roller.Layout = patternLayout; roller.PreserveLogFileNameExtension = true; roller.MaxFileSize = 50 * 1024 * 1024; // 50 MB roller.MaxSizeRollBackups = -1; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; }
public static void SetConfig() { try { Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender tracer = new TraceAppender(); PatternLayout patternLayout = new PatternLayout(); patternLayout.ConversionPattern = LOG_PATTERN; patternLayout.ActivateOptions(); tracer.Layout = patternLayout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); RollingFileAppender roller = new RollingFileAppender(); roller.Layout = patternLayout; roller.AppendToFile = true; roller.RollingStyle = RollingFileAppender.RollingMode.Size; roller.MaxSizeRollBackups = 4; roller.MaximumFileSize = "100KB"; roller.StaticLogFileName = true; if (String.IsNullOrEmpty(theDirectory)) { string fullPath = System.Reflection.Assembly.GetAssembly(typeof(Logger)).Location; //get the folder that's in theDirectory = Path.GetDirectoryName(fullPath); } roller.File = theDirectory + @"\CxVsPlugin.log"; roller.ActivateOptions(); hierarchy.Root.AddAppender(roller); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; } catch (Exception ex) { Logger.Create().Error(ex.ToString()); } }
//[ClassInitialize] public static void Initialize(TestContext ctx) { Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); TraceAppender tracer = new TraceAppender(); tracer.ImmediateFlush = true; //PatternLayout layout = new PatternLayout(); //layout.ConversionPattern = LOG_PATTERN; //layout.ActivateOptions(); JsonLayout layout = new JsonLayout(); layout.ActivateOptions(); tracer.Layout = layout; tracer.ActivateOptions(); hierarchy.Root.AddAppender(tracer); HttpPostAppender appender = new HttpPostAppender() { BufferSize = 20 }; appender.Layout = layout; appender.PostUrl = "http://requestb.in/1euiz3m1"; appender.LogSourceIdentity = "test"; appender.ActivateOptions(); hierarchy.Root.AddAppender(appender); //FileAppender appender = new FileAppender(); //appender.Layout = layout; //appender.File = @"..\..\utest.log"; //appender.AppendToFile = true; //appender.ActivateOptions(); //hierarchy.Root.AddAppender(appender); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; }
/// <summary> /// Utility function to initialize logging. This will check for a log configuration file /// and use that to configure the logging. If the log configuration file is not available, /// this method will check the default log configuration file. If that file is not /// available either, this method will create a primitive configuration that writes logs to /// the filename specified as the defaultLogfileName /// </summary> /// <param name="configFilename">the path (can be relative) to the log config file</param> /// <param name="defaultConfigFilename">the path (can be relative) to the default log config file</param> /// <param name="defaultLogfileName">the filename to use for logging if the config files are not found</param> public static void InitializeLogging(string configFilename, string defaultConfigFilename, string defaultLogfileName, bool interactive) { if (File.Exists(configFilename)) { XmlConfigurator.ConfigureAndWatch(new FileInfo(configFilename)); } else if (File.Exists(defaultConfigFilename)) { XmlConfigurator.ConfigureAndWatch(new FileInfo(defaultConfigFilename)); } else { // should only get here if someone has a messed up install if (interactive) { RollingFileAppender rfa = new RollingFileAppender(); rfa.Layout = new PatternLayout("%-5p [%d{ISO8601}] %-20.20c{1} %m%n"); rfa.File = defaultLogfileName; rfa.AppendToFile = false; rfa.MaximumFileSize = "5MB"; rfa.MaxSizeRollBackups = 2; rfa.RollingStyle = RollingFileAppender.RollingMode.Once; rfa.ActivateOptions(); BasicConfigurator.Configure(rfa); SetLogLevel(log4net.Core.Level.Info, true); } else { // use the trace appender if we are not running interactive TraceAppender ta = new TraceAppender(); ta.Layout = new PatternLayout("%-5p [%d{ISO8601}] %-20.20c{1} %m%n"); ta.ActivateOptions(); BasicConfigurator.Configure(ta); SetLogLevel(log4net.Core.Level.Info, true); } logUtilLog.Info("Unable to find logging config files. Using fallback simple logging configuration."); logUtilLog.InfoFormat("Logging config file: {0}", configFilename); } }