log4net.config 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3. <!-- This section contains the log4net configuration settings -->
  4. <log4net>
  5. <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
  6. <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" />
  7. </appender>
  8. <appender name="FileAppender" type="log4net.Appender.FileAppender">
  9. <param name="Encoding" value="utf-8" />
  10. <file value="log-file.log" />
  11. <appendToFile value="true" />
  12. <layout type="log4net.Layout.PatternLayout">
  13. <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
  14. </layout>
  15. </appender>
  16. <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
  17. <param name="Encoding" value="utf-8" />
  18. <file value="logfile/" />
  19. <appendToFile value="true" />
  20. <rollingStyle value="Composite" />
  21. <staticLogFileName value="false" />
  22. <datePattern value="yyyyMMdd'.log'" />
  23. <maxSizeRollBackups value="10" />
  24. <maximumFileSize value="1MB" />
  25. <layout type="log4net.Layout.PatternLayout">
  26. <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
  27. </layout>
  28. </appender>
  29. <!-- Setup the root category, add the appenders and set the default level -->
  30. <root>
  31. <level value="ALL" />
  32. <appender-ref ref="ConsoleAppender" />
  33. <appender-ref ref="FileAppender" />
  34. <appender-ref ref="RollingLogFileAppender" />
  35. </root>
  36. </log4net>
  37. </configuration>