[
https://issues.apache.org/jira/browse/LOG4J2-2121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16255395#comment-16255395
]
Seweryn Habdank-Wojewodzki commented on LOG4J2-2121:
----------------------------------------------------
No I have one log per day, but I need to limit overall number of days/logs.
I mean I prefer to avoid to write any kind of extra tool to purge old logs.
Of course when it is needed, I will do it, but I suppose Log4j2 has such a
possibility.
> DefaultRolloverStrategy max = 5 does not limit nuber of files
> -------------------------------------------------------------
>
> Key: LOG4J2-2121
> URL: https://issues.apache.org/jira/browse/LOG4J2-2121
> Project: Log4j 2
> Issue Type: Question
> Environment: Linux RedHat
> Reporter: Seweryn Habdank-Wojewodzki
>
> Dears,
> I have very simple configuration of the RollingFile appender
> {code:xml}
> <RollingFile name="RollingFile"
> fileName="${env:LOG_DIR}/${application}/endpoint.log"
>
> filePattern="$${env:LOG_DIR}/$${application}/$${date:yyyy-MM}/endpoint-%d{yyyy-MM-dd}-%i.log">
> <PatternLayout>
> <Pattern>%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n</Pattern>
> </PatternLayout>
> <Policies>
> <TimeBasedTriggeringPolicy />
> </Policies>
> <DefaultRolloverStrategy max="5"/>
> </RollingFile>
> {code}
> This configuration works partly good. Every day there is created file in
> folder _YYYY-MM_.
> That is expected.
> What is not expected - it is that the process is not limited at all. I mean
> there are more than 5 files in all folders.
> Questions:
> Is it something wrong with configuration?
> is max=5 considered to be the numeber of files or folders (in my case months)?
> or max=5 is ignored at all.
> I had read some hints in SO: [How does Log4j2 DefaultRolloverStrategy's max
> attribute really
> work?|https://stackoverflow.com/questions/24551768/how-does-log4j2-defaultrolloverstrategys-max-attribute-really-work]
> Thanks in advance for help.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)