Logging

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(New page: == Changing logging levels before startup == OpenSim uses the [http://logging.apache.org/log4net/ log4net] package for logging. This means that every executable you run for OpenSim has a...)
 
(Changing logging levels before startup)
Line 5: Line 5:
 
For instance, the OpenSim.exe.config file looks like this.
 
For instance, the OpenSim.exe.config file looks like this.
  
<?xml version="1.0" encoding="utf-8" ?>
+
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
+
<configuration>
 
   <configSections>
 
   <configSections>
 
     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
 
     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
Line 39: Line 39:
 
     </root>
 
     </root>
 
   </log4net>
 
   </log4net>
</configuration>
+
</configuration>
  
 
This looks rather complicated, but if you want to change the level of messages logged, then you could change the value in
 
This looks rather complicated, but if you want to change the level of messages logged, then you could change the value in

Revision as of 14:39, 20 August 2008

Changing logging levels before startup

OpenSim uses the log4net package for logging. This means that every executable you run for OpenSim has an accompanying .config file which contains the logging configuration

For instance, the OpenSim.exe.config file looks like this.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <configSections>
   <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
 </configSections>
 <appSettings>
 </appSettings>
 <log4net>
   <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
     <layout type="log4net.Layout.PatternLayout">
       <conversionPattern value="%date{HH:mm:ss} - %message%newline" />
     </layout>
   </appender>
   <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
     <file value="OpenSim.log" />
     <appendToFile value="true" />
     <layout type="log4net.Layout.PatternLayout">
       <conversionPattern value="%date %-5level - %logger %message%newline" />
     </layout>
   </appender>
   <logger name="NHibernate" additivity="false">
     <level value="INFO"/>
     <appender-ref ref="NHibernateFileLog"/>
   </logger>
   <root>
     <level value="DEBUG" />
     <appender-ref ref="Console" />
     <appender-ref ref="LogFileAppender" />
   </root>
 </log4net>
</configuration>

This looks rather complicated, but if you want to change the level of messages logged, then you could change the value in

<level value="DEBUG" />

to something different, e.g.

<level value="WARN" />

which will only display warning and error level log messages. Permissible values are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF

You can also see from the OpenSim.exe.config file that log files are written to OpenSim.log (as well as the console).

Setting log levels during runtime

It isn't currently possible to change the level of logging to the log file during runtime. However, it is possible to change the level sent to the console. You can do this by executing the

set log level [<level>]

command. For example

set log level error

will mean only errors are sent to the console. The log still receives messages that meet the level set in the OpenSim.exe.config file at startup.

Changing the log level sent to the console will not persist over restarts. If you want the change to be permanent, you can set a threshold value in the ConsoleAppender (see the log4net docs for more details).

Personal tools
General
About This Wiki