Log4net.config: Difference between revisions

From MXMS Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
To provide a robust logging framework MXMS uses log4net as it's logging framework. log4net can be configured using their xml configuration file which should be located in the [[workingdirectory]] and is named log4net.config. Appenders can be added to the log4.net logging engine.
== Example configuration ==
== Example configuration ==
<pre>
<pre>

Revision as of 06:36, 31 March 2026

To provide a robust logging framework MXMS uses log4net as it's logging framework. log4net can be configured using their xml configuration file which should be located in the workingdirectory and is named log4net.config. Appenders can be added to the log4.net logging engine.

Example configuration

<?xml version="1.0" encoding="UTF-8"?>
<log4net>
  <root>
    <priority value="ERROR"/>
    <appender-ref ref="rollingFile" />
  </root>
  <appender name="rollingFile" type="log4net.Appender.RollingFileAppender">
    <file type="log4net.Util.PatternString" value="mxms\Logs\trace-log.txt" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <maximumFileSize value="5MB" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value=" %date %-5level %logger - %message%newline" />
    </layout>
    <encoding value="utf-8" />
  </appender>
</log4net>