Jordan Guerin created LOG4J2-1112:
-------------------------------------

             Summary: 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 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to