[
https://issues.apache.org/jira/browse/LOG4J2-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14728449#comment-14728449
]
Remko Popma commented on LOG4J2-435:
------------------------------------
I suspect that people may have different requirements on which files can be
deleted.
Rather than a maxAge attribute, perhaps we can introduce a {{DeletePolicy}},
with a set of conditions that select files to delete. An example follows below:
{code}
<RollingRandomAccessFile name="RollingRandomAccessFile" fileName="logs/app.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
<DeletePolicy baseDirectory="logs"><!-- start looking in the logs directory
-->
<And> <!-- both of the nested conditions must be true -->
<FileAgeCondition age="15d" /> <!-- files age is 15 days or older -->
<NameMatchCondition pattern=".*/app.*\\.log\\.gz" /> <!-- file name
matches regular expression -->
</And>
</DeletePolicy>
</RollingRandomAccessFile>
{code}
> Support limiting number of log files based on date pattern
> ----------------------------------------------------------
>
> Key: LOG4J2-435
> URL: https://issues.apache.org/jira/browse/LOG4J2-435
> Project: Log4j 2
> Issue Type: Improvement
> Reporter: Arkin Yetis
> Assignee: Ralph Goers
> Labels: Rollover
> Attachments: LimitingRolloverStrategy.java, SizeParser.java
>
>
> DefaultRolloverStrategy max attribute only applies if you have a %i in the
> file pattern. This request is to enhance DefaultRolloverStrategy or another
> appropriate component to allow a max number of files limit to apply across
> days/months/years when a filePattern includes a date pattern.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]