Difference between revisions of "Selective Logging"

From SIMA wiki
Jump to: navigation, search
(Created page with "If there is more than one agen within a simulation it is not very usefule to log all messages to one console. If you want to seperate the log messages of each agent you must w...")
 
(Usage)
Line 3: Line 3:
 
To create the logger use the line:
 
To create the logger use the line:
  
log4j.appender.[NAME]=logger.MultipleAppender
+
log4j.appender.[APPENDER_NAME]=logger.SelectiveFileAppender
  
within the logging config file.
+
within the logging config file. No properties are needed.
  
 
use the logger configuration to add the appender to a specific logger e.g.:
 
use the logger configuration to add the appender to a specific logger e.g.:

Revision as of 10:11, 28 August 2014

If there is more than one agen within a simulation it is not very usefule to log all messages to one console. If you want to seperate the log messages of each agent you must write them to seperate files. Theirefor the custom appender SelectiveFileAppender war created. This creates a seperate logging file for each agent and one for general messages within the Simulation/logging directory.

Usage

To create the logger use the line:

log4j.appender.[APPENDER_NAME]=logger.SelectiveFileAppender

within the logging config file. No properties are needed.

use the logger configuration to add the appender to a specific logger e.g.:

log4j.logger.F1=ERROR, [APPENDER_NAME]

You can append more than one appender by seperating the wir ','