DIVAs 4 employes Apache log4j, a Java-based logging utility, to capture the simulation logging information that can be used later for further analysis. log4j is highly configurable through external configuration files at runtime. In this tutorial we describe the process of specifying the configuration of a Log4j file for the traffic simulaton module.
Configuration Steps
- Right click on the “traffic-simulation”> module and create a new file and name it “log4j.properties”.
- Write the following code that indicates that the logging information will be appended to the file “admin.log”. For a detailed information on how to set these prperties, please refer to the Apache Log4j project website.
# Set root logger level log4j.rootLogger=WARN, A1, AdminFileAppender #, CoalescingStatistics # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss.SSS} %-5p [%-26t] %-20c{1}: - %-30m%n # Set logger levels log4j.logger.edu.utdallas.mavs.divas=INFO log4j.logger.edu.utdallas.mavs.matisse=INFO log4j.logger.org.perf4j.TimingLogger=WARN log4j.logger.org.apache.activemq=ERROR log4j.logger.org.apache.activemq.spring=ERROR # AdminFileAppender - used to log messages in the admin.log file. log4j.appender.AdminFileAppender=org.apache.log4j.FileAppender log4j.appender.AdminFileAppender.File=admin.log log4j.appender.AdminFileAppender.layout=org.apache.log4j.PatternLayout log4j.appender.AdminFileAppender.layout.ConversionPattern=%d{HH:mm:ss.SSS} %-5p [%-21t] %-20c{1}: - %-30m%n # Time log4j.appender.CoalescingStatistics=org.perf4j.log4j.AsyncCoalescingStatisticsAppender log4j.appender.CoalescingStatistics.TimeSlice=1000