You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Jordan Guerin (JIRA)" <ji...@apache.org> on 2015/09/04 17:57:45 UTC
[jira] [Updated] (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 ]
Jordan Guerin updated LOG4J2-1112:
----------------------------------
Environment: Encountered on Ubuntu 64bit with Java 8, on CentOS with Java 8 too. (was: Encountered on Ubuntu 64bit with Java 8, on CentOS with Java too.)
> 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
>
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org