6.5. Changing the Timezone of Log Messages


VoltDB Home » Documentation » Administrator's Guide

6.5. 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.DailyRollingFileAppender">
        <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"/>

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

To customize the timezone when using the VoltDB Enterprise Manager, you must specify the layout class and pattern using the Log4J properties file in the /management folder. For example, the following code appended to the file server_log4j.properties would make the same change to the timezone for clusters started with the Enterprise Manager as the preceding example would when starting a server manually:

# Add your own log4j configurations below this line

log4j.appender.file.layout.ConversionPattern=%d{ISO8601}{GMT-4}   %-5p [%t] %c: %m%n