Difference between revisions of "Selective Logging"
(→Usage) |
|||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
within the logging config file. No properties are needed. | 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] | log4j.logger.F1=ERROR, [APPENDER_NAME] | ||
− | You can append more than one appender by seperating the | + | You can append more than one appender by seperating the with ',' |
Example: | Example: | ||
Line 19: | Line 19: | ||
== Visualisation == | == Visualisation == | ||
To live view this logging files use the eclipse plug in "Log Viewer" (installation link - http://logviewer.eclipselabs.org.codespot.com/git/de.anbos.eclipse.logviewer.update/) | To live view this logging files use the eclipse plug in "Log Viewer" (installation link - http://logviewer.eclipselabs.org.codespot.com/git/de.anbos.eclipse.logviewer.update/) | ||
+ | |||
If you want to use the log viewer, dissable the options ("show console when std. out changes" and "show console when std. error changes"). | If you want to use the log viewer, dissable the options ("show console when std. out changes" and "show console when std. error changes"). | ||
[[File:Console settings.png]] | [[File:Console settings.png]] |
Latest revision as of 09:21, 28 August 2014
If there is more than one agent within a simulation it is not very useful 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 with ','
Example:
Visualisation
To live view this logging files use the eclipse plug in "Log Viewer" (installation link - http://logviewer.eclipselabs.org.codespot.com/git/de.anbos.eclipse.logviewer.update/)
If you want to use the log viewer, dissable the options ("show console when std. out changes" and "show console when std. error changes").