6.3. Changing the Timezone of Log Messages

Documentation

VoltDB Home » Documentation » Administrator's Guide

6.3. Changing the Timezone of Log Messages

By default all VoltDB logging is reported in GMT (Greenwich Mean Time). If you want the logging to be reported using a different timezone, you can use extensions to the Log4J service to achieve this.

To change the timezone of log messages:

  1. Download the extras kit from the Apache Extras for Apache Log4J website, http://logging.apache.org/log4j/extras/.

  2. Unpack the kit and place the included JAR file in the /lib/extension folder of the VoltDB installation directory.

  3. Update your Log4J configuration file to enable the Log4J extras and specify the desired timezone for logging for each appender.

You enable the Log4J extras by specifying EnhancedPatternLayout as the layout class for the appenders you wish to change. You then identify the desired timezone as part of the layout pattern. For example, the following XML fragment changes the timezone of messages written to the file appender to GMT minus four hours:

<appender name="file" class="org.apache.log4j.DailyMaxRollingFileAppender">
  <param name="file" value="log/volt.log"/>
  <param name="DatePattern" value="'.'yyyy-MM-dd" />
  <layout class="org.apache.log4j.EnhancedPatternLayout">
     <param name="ConversionPattern" 
            value="%d{ISO8601}{GMT-4}   %-5p [%t] %c: %m%n"/>
  </layout>
</appender>

You can use any valid ISO-8601 timezone specification, including named timezones, such as EST.