Set up custom logging

From libopenmetaverse - libomv - Developer Wiki

Jump to: navigation, search

The log config file is stored in whatever you call your .exe file. For example: TestClient.exe.config for TestClient.exe or OpenSim.exe.config for Opensim.exe.

Every executable has their own log4net configuration file.

You must customise the <logger name = "XXX"> below for your package. "OpenMetaverse" will work for everything shipped with libopenmetaverse.

Example Log Config

 
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
    
    <log4net>
        <appender name="FileAppender" type="log4net.Appender.FileAppender">
            <file value="MyLog.txt" />
            <appendToFile value="true" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level - %message%newline" />
            </layout>
        </appender>
        <logger name="OpenMetaverse">
            <level value="DEBUG" />
            <appender-ref ref="FileAppender" />
        </logger>
    </log4net>
</configuration>