public Log4NetLoggingService() { if (string.IsNullOrEmpty(Logger.DirFullPath)) { throw new InvalidProgramException(); } string logFile = Path.Combine(Logger.DirFullPath, CommandLineArgs.GetLogFileName()); byte[] buffer = System.Text.Encoding.UTF8.GetBytes( $@"<log4net> <root> <level value=""ALL"" /> <appender-ref ref=""RollingFileAppender"" /> </root> <appender name=""RollingFileAppender"" type =""log4net.Appender.RollingFileAppender"" > <filter type=""log4net.Filter.LevelRangeFilter"" > </filter> <param name=""File"" value =""{logFile}"" /> <param name=""AppendToFile"" value =""true"" /> <param name=""MaxSizeRollBackups"" value =""10"" /> <param name=""MaximumFileSize"" value =""2MB"" /> <param name=""RollingStyle"" value =""Size"" /> <param name=""StaticLogFileName"" value =""true"" /> <layout type=""log4net.Layout.PatternLayout"" > <param name=""ConversionPattern"" value =""%d [%t] %-5p %c - %m%n"" /> </layout> </appender> </log4net>"); using (MemoryStream ms = new MemoryStream(buffer)) { XmlConfigurator.Configure(ms); } _log = LogManager.GetLogger("global"); }