[ https://issues.apache.org/jira/browse/LOG4J2-2121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16255422#comment-16255422 ]
Remko Popma commented on LOG4J2-2121: ------------------------------------- Rolling file appender has a custom delete function: https://logging.apache.org/log4j/2.x/manual/appenders.html#CustomDeleteOnRollover This may fit your needs. > 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)