You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Markus Spann (Jira)" <ji...@apache.org> on 2021/07/14 10:00:20 UTC
[jira] [Commented] (LOG4J2-3038) RollingFileAppender ignores
TimeZone-Pattern
[ https://issues.apache.org/jira/browse/LOG4J2-3038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17380479#comment-17380479 ]
Markus Spann commented on LOG4J2-3038:
--------------------------------------
[~de-ka]
Why with your given config would *{{log-2021-03-10-10+0100.log}}* get rolled to *{{Logs/opc-xml-da2-2021-03-10-10+0100.log.gz}}*? (Note the different file names.)
Have you posted the correct log4j2 configuration file?
> 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
> Assignee: Carter Kozak
> Priority: Major
>
> 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)