[ https://issues.apache.org/jira/browse/LOG4J2-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jordan Guerin updated LOG4J2-1112: ---------------------------------- Description: 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 was: 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. > 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. I > tried with interval of 2, and the date is still okay. > So the bug occurs only when we put -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org