Agent Logging Fundamentals
The default Agent logger is defined in the file <installdir>\conf\loggers.xml. Let’s examine this file:
 
<loggers xmlns="http://www.roguewave.com/rwsf/loggers">
<!-- To stdout --> 1
<logger name="stdout.info" class="rwsf_core.createLogLevelFilter">
<property name="logger" value="stdout"/>
<property name="filter" value="info"/>
</logger>
 
<!-- To the file agent.log --> 2
<!--logger name="rwsf.agent.logfile"
class="rwsf_core.createRotatingFileLogger">
<property name="filename" value="${RWSF_HOME}/logs/agent.log"/>
<property name="formatter" value="rwsf_core.createLogTimeFormatter"/>
<property name="mode" value="append"/>
<property name="measurement" value="mb"/>
<property name="measuresize" value="1"/>
<property name="cleanup" value="y"/>
<property name="logfilenum" value="10"/>
<property name="logdir" value="${RWSF_HOME}/logs"/>
</logger-->
 
<logger name="rwsf.agent.logfile" class="rwsf_core.createFileLogger"> 3
<property name="filename" value="${RWSF_HOME}/logs/agent.log"/>
<property name="formatter" value="rwsf_core.createLogTimeFormatter"/>
<property name="mode" value="overwrite"/>
</logger>
 
<!-- Filter the previously created file logger. --> 4
<logger name="rwsf.agent.logfile.verbose"
class="rwsf_core.createLogLevelFilter">
<property name="logger" value="rwsf.agent.logfile"/>
<property name="filter" value="verbose"/>
</logger>
<!-- Create logger that writes to two locations --> 5
<logger name="rwsf.agent.log" class="rwsf_core.createLogSplitter"
default="true">
<property name="logger1" value="stdout.info"/>
<property name="logger2" value="rwsf.agent.logfile.verbose"/>
</logger>
</loggers>
//1 Creates a logger that writes to stdout at the level INFO or above (more critical). See below for more information on levels. Both the logger and the level filter can be created in a single entry for stdout and stderr.
//2 Creates a rotating log file that allows you to set files size and number limitations, designate when log files should be archived and timestamped, and perform cleanup when old timestamped files should be removed. This section is currently commented out so that you can use the default log file writing functionality. If you wish to keep old log files, you can do so but also limit the size of the log files to keep by setting the measurement, measuresize, cleanup, logfilenum, and logdir values. To use this functionality, remove the comment tags from this section and comment out the default logger functionality just below it. The mode is append, which maintains log entries across Agent restarts.
//3 To write to a file, you must first create a file logger, then define the filter in a subsequent entry. This logger writes to installdir\logs\agent.log.
The formatter appends a timestamp to the entry. Currently, rwsf_core.createLogTimeFormatter is the only valid value for the formatter property, although you can create a custom formatter by deriving from the rwsf::LogFormatter class.
The mode creates a new, empty log every time the Agent is restarted. The alternative mode is append, which maintains log entries across Agent restarts.
//4 Creates a filter for the file logger just defined that writes at the VERBOSE level or above.
//5 Creates a logger that passes log messages to the two previously defined loggers. This is the default logger for the Agent.
The defined log levels are:
NONE
No logging
FATAL
Fatal messages only
ERROR
Error and Fatal
WARN
Warn, Error, and Fatal
INFO
Info, Warn, Error, and Fatal
VERBOSE [default]
Verbose, Info, Warn, Error, and Fatal
DEBUG
Debug, Verbose, Info, Warn, Error, and Fatal
The default Agent logger is set to VERBOSE.