D. Kahlert created LOG4J2-3038:
----------------------------------

             Summary: RollingFileAppender ignores TimeZone-Pattern
                 Key: LOG4J2-3038
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3038
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.14.0
            Reporter: D. Kahlert


h2. 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>
h2. 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 
Logs/opc-xml-da2-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

 

Local time is GMT+1 (Berlin), at program start log4j calculates the correct 
filename, but at rollup, it works with the local time zone and ignores the time 
zone pattern from the configuration.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to