Carter Kozak created LOG4J2-2423:
------------------------------------

             Summary: Rolled files are not deleted when a date is used in the 
pattern
                 Key: LOG4J2-2423
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2423
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
            Reporter: Carter Kozak


In my appender definition I set 
filePattern="app/log/trace.%d\{yyyy-MM-dd}-%i.log.gz"
I would expect to see a maximum of 7 rolled trace logs, however I have 
accumulated over 30.

While running in a debugger, in AbstractRolloverStrategy.getEligibleFiles I see 
filePattern set to "trace.2018-08-22-(\d+).log.*". I would expect the date to 
be replaced to something along the lines of 
"trace.(\d+)-(\d+)-(\d+)-(\d+).log.*"

Based on the documentation and javadoc this doesn't appear to be entirely 
unexpected, however it is odd that based on the presence of a date in the file 
pattern a default rolling file appender may create up to 7 total files, or up 
to 7 files per date pattern minimum interval.

I'm curious if this has been discussed elsewhere that I may have missed, or if 
this is consistent with others expectation of DefaultRolloverStrategy. If so I 
will update the documentation to be clearer around this point.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to