Add a timezone to the RollingRandomAccessFile configurationThe <RollingRandomAccessFile> directive controls the log files the Agent creates. Within this directive find the <PatternLayout> directive and add your preferred timezone to the <Pattern> directive. You can see a list of timezones here under the TZ database name column. For example: <?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p - %t - %c{1} - %m%n"/>
</Console>
<RollingRandomAccessFile name="FILE" fileName="logs/perspectium.log"
filePattern="logs/perspectium-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}{America/New_York} %-5p - %t - %c{1} - %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="20 MB"/>
</Policies>
<DefaultRolloverStrategy max="14"/>
</RollingRandomAccessFile>
<Async name="ASYNC">
<AppenderRef ref="FILE"/>
<AppenderRef ref="CONSOLE"/>
</Async>
</Appenders>
<Loggers>
<logger name="org.apache.http" level="error" additivity="false">
<AppenderRef ref="ASYNC"/>
</logger>
<logger name="com.perspectium.db" level="info">
<AppenderRef ref="ASYNC"/>
</logger>
<logger name="org.springframework" level="info">
<AppenderRef ref="ASYNC"/>
</logger>
<Root level="info">
<AppenderRef ref="ASYNC"/>
</Root>
</Loggers>
</Configuration> |
Notice the <Pattern> directive has the {America/New_York} tag added so logs will be using the Eastern timezone ({America/New_York} will account for both daylight and standard times). In this example we're only updating the timezone of the log files but if you would like to update the console (in the case of running in foreground mode), change <PatternLayout> in the <Console> directive as well. |