[
https://issues.apache.org/jira/browse/LOG4J2-2423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16595082#comment-16595082
]
Ralph Goers commented on LOG4J2-2423:
-------------------------------------
The max files parameter limits the number of files that will be saved during a
time-based rollover "window". So if you have max files set to 7 and a time
pattern of 1 day then you will only have 7 files per day. If you want to limit
the total number of files you either can't use a time based rollover or you
need to use the delete action to clean things up.
> 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
> Assignee: Carter Kozak
> Priority: Major
>
> 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)