Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.14.0
-
None
-
None
-
Local time zone: GMT+1 (Berlin)
Java-Version: 8
Description
At program start log4j calculates the correct time zone. For rolling up, it works with the local time and ignores the time zone pattern from the configuration.
Configuration
<RollingFile name="RollingFile" filePattern="log-%d{yyyy-MM-dd-HHZ}.log.gz">
<PatternLayout>
<Pattern>%d %-5p [%t] %C{2} (%F:%L) - %m%n</Pattern>
</PatternLayout>
<Policies>
<CronTriggeringPolicy schedule="0 0 * * * ?"/>
</Policies>
</RollingFile>
Result
2021-03-10 11:00:00,088 ... DEBUG Setting prev file time to 2021-03-10T10:00:00.000+0100
2021-03-10 11:00:00,088 ... DEBUG Rolling log-2021-03-10-10+0100.log
2021-03-10 11:00:00,088 ... DEBUG Formatting file name. useCurrentTime=false. currentFileTime=1615366800000, prevFileTime=1615366800000
2021-03-10 11:00:00,088 ... DEBUG Found 0 eligible files, max is 2147483647
2021-03-10 11:00:00,111 ... DEBUG OutputStream closed
2021-03-10 11:00:00,111 ... DEBUG RollingFileManager executing async GzCompressAction[log-2021-03-10-10+0100.log to log-2021-03-10-10+0100.log.gz, deleteSource=true]
2021-03-10 11:00:00,196 ... DEBUG Formatting file name. useCurrentTime=false. currentFileTime=1615366800000, prevFileTime=1615366800000
2021-03-10 11:00:00,196 ... DEBUG Formatting file name. useCurrentTime=true. currentFileTime=1615366800000, prevFileTime=1615366800000
2021-03-10 11:00:00,196 ... DEBUG Now writing to log-2021-03-10-10+0100.log at 2021-03-10T11:00:00.196+0100
2021-03-10 11:00:00,199 ... DEBUG Log4j2 ConfigurationScheduler Cron expression 0 0 * * * ? scheduled to fire again at 2021-03-10T12:00:00.000+0100
Attachments
Issue Links
- is fixed by
-
LOG4J2-3038 RollingFileAppender ignores TimeZone-Pattern
- Closed