You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2019/07/29 04:42:00 UTC
[jira] [Closed] (LOG4J2-1112) Using both OnStartupTriggeringPolicy
and TimeBasedTriggeringPolicy create log file with wrong date
[ https://issues.apache.org/jira/browse/LOG4J2-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ralph Goers closed LOG4J2-1112.
-------------------------------
Resolution: Cannot Reproduce
Closing due to lack of feedback
> Using both OnStartupTriggeringPolicy and TimeBasedTriggeringPolicy create log file with wrong date
> --------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-1112
> URL: https://issues.apache.org/jira/browse/LOG4J2-1112
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.3
> Environment: Encountered on Ubuntu 64bit with Java 8, on CentOS with Java 8 too.
> Reporter: Jordan Guerin
> Assignee: Ralph Goers
> Priority: Major
> Attachments: log4j2.xml
>
>
> We found this bug while we were updating our logging library (from log4j 1.x to 2.3)
> We want to use mylog-%date\{yyyyMMdd-HHmmss} as filePattern for a RollingFileAppender.
> We're using 3 policies
> <OnStartupTriggeringPolicy />
> <SizeBasedTriggeringPolicy size="100 MB" />
> <TimeBasedTriggeringPolicy interval="86400" modulate="true" />
> We want to roll the file at each day, so we put 86400 seconds as the interval.
> But the problem we encounter, when the OnStartupTriggeringPolicy is triggering, our log file is named : mylog-20150905-114259.log instead of
> mylog-20150904-114259.log.
> It seems like the interval time of the TimeBasedTriggeringPolicy is added to the Date of the log filename. I did some further investigating, and when I put 3600 (one hour in seconds) as interval. Only one hour is added to the log filename.
> If I remove the OnStartupTriggeringPolicy, when it roll with the TimeBasedTrigger, the date is correct.
>
> What is weird too, if I use mylog-%date\{yyyyMMdd} and interval is 1 for TimeBasedTrigger, the date is correct when the log file roll on Startup. I tried with interval of 2, and the date is still okay.
> So the bug occurs only when we put time unit into the %date, when we use day unit, the date of the log filename is correct, but with minutes and seconds, we got a date in the future.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)