Log4net.config: Difference between revisions

From MXMS Wiki
Jump to navigationJump to search
Created page with "<?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" /> <layo..."
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
To provide a robust logging framework MXMS uses [https://logging.apache.org/log4net/index.html log4net] as it's logging framework. log4net can be configured using their xml configuration file which should be located in the [[MXMSConfiguration#Workingdirectory|workingdirectory]] and is named log4net.config. Appenders can be added to the log4.net logging engine.
== Example configuration ==
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<log4net>
<log4net>
Line 17: Line 21:
   </appender>
   </appender>
</log4net>
</log4net>
</pre>

Latest revision as of 06:23, 3 April 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>