+1 (972) 883-2091
ECSS 4.220, 800 W Campbell Rd, Richardson, TX 75083–0688, US

Setting Logging Properties

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 evacuation simulaton module.

Configuration Steps

  1. Right click on the “evacuation-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=INFO, 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.org.perf4j.TimingLogger=INFO
    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
    #log4j.appender.CoalescingStatistics.layout=org.apache.log4j.PatternLayout
    #log4j.appender.CoalescingStatistics.layout.ConversionPattern=%d{HH:mm:ss.SSS} %-5p [%-21t] %-20c{1}: - %-30m%n
    
    #Performance - TPS
    #log4j.appender.JmxAttributeStatisticsAppender=org.perf4j.log4j.JmxAttributeStatisticsAppender
    #log4j.appender.JmxAttributeStatisticsAppender.TagNamesToExpose=No_Reorganization-AGENT, No_Reorganization-ENVIRONMENT