[ https://issues.apache.org/jira/browse/LOG4J2-1400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15306531#comment-15306531 ]
Ralph Goers commented on LOG4J2-1400: ------------------------------------- The list of files you are showing looks correct. max="7" indicates that only 7 files will be kept for the interval (1 day). If you want only 7 files total then you should configure a Delete action. See the section "Log Archive Retention Policy: Delete on Rollover" at http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender > RollingRandomAccessFile is not able to rotate log files > ------------------------------------------------------- > > Key: LOG4J2-1400 > URL: https://issues.apache.org/jira/browse/LOG4J2-1400 > Project: Log4j 2 > Issue Type: Bug > Affects Versions: 2.5 > Environment: centos6 and 7, Java8, log4j2 2.5 > Reporter: Norbert Mazurkiewicz > Priority: Minor > > In configuration like this: > {code} > <Appender type="RollingRandomAccessFile" name="file" > fileName="/var/log/my_logs/my_log.log" > filePattern="/var/log/my_logs/my_log.log.%d{yyyy-MM-dd}-%i"> > <Layout type="PatternLayout" pattern="[%-5p]%X{TRANSACTION} %d %c > - %m%n"/> > <Policies> > <OnStartupTriggeringPolicy/> > <TimeBasedTriggeringPolicy interval="1"/> > <SizeBasedTriggeringPolicy size="5GB"/> > </Policies> > <DefaultRolloverStrategy max="7"/> > > </Appender> > {code} > If application was restarted Log4j2 is creating each time one log file (up to > 7 per one day) but older files should be deleted. In my case (4 application) > rotating is working in range of one day in configuration presented above. > for instance list of log files: > -rw-r--r--. 1 tomcat tomcat 55149 May 16 15:31 my_log.2016-05-16-4 > -rw-r--r--. 1 tomcat tomcat 168620 May 16 15:37 my_log.2016-05-16-5 > -rw-r--r--. 1 tomcat tomcat 688303 May 16 23:57 my_log.2016-05-16-6 > -rw-r--r--. 1 tomcat tomcat 927257 May 17 12:51 my_log.2016-05-17-1 > -rw-r--r--. 1 tomcat tomcat 343468 May 17 15:25 my_log.2016-05-17-2 > -rw-r--r--. 1 tomcat tomcat 95333 May 17 15:27 my_log.2016-05-17-3 > -rw-r--r--. 1 tomcat tomcat 86964 May 17 15:35 my_log.2016-05-17-4 > -rw-r--r--. 1 tomcat tomcat 107729 May 17 15:40 my_log.2016-05-17-5 > -rw-r--r--. 1 tomcat tomcat 731422 May 17 23:56 my_log.2016-05-17-6 > -rw-r--r--. 1 tomcat tomcat 72852 May 18 14:57 my_log.2016-05-18-1 > -rw-r--r--. 1 tomcat tomcat 160570 May 18 15:05 my_log.2016-05-18-2 > -rw-r--r--. 1 tomcat tomcat 171330 May 18 15:06 my_log.2016-05-18-3 > -rw-r--r--. 1 tomcat tomcat 93736 May 18 15:08 my_log.2016-05-18-4 > -rw-r--r--. 1 tomcat tomcat 674834 May 18 17:44 my_log.2016-05-18-5 > -rw-r--r--. 1 tomcat tomcat 971408 May 18 22:12 my_log.2016-05-18-6 > -rw-r--r--. 1 tomcat tomcat 456906 May 18 23:58 my_log.2016-05-18-7 > -rw-r--r--. 1 tomcat tomcat 175348 May 19 16:23 my_log.2016-05-19-1 > -rw-r--r--. 1 tomcat tomcat 98372 May 19 16:34 my_log.2016-05-19-2 > -rw-r--r--. 1 tomcat tomcat 177815 May 19 16:40 my_log.2016-05-19-3 > -rw-r--r--. 1 tomcat tomcat 149381 May 19 16:46 my_log.2016-05-19-4 > -rw-r--r--. 1 tomcat tomcat 78101 May 19 17:02 my_log.2016-05-19-5 > -rw-r--r--. 1 tomcat tomcat 162786 May 19 17:08 my_log.2016-05-19-6 > -rw-r--r--. 1 tomcat tomcat 223561 May 19 23:58 my_log.2016-05-19-7 > -rw-r--r--. 1 tomcat tomcat 87573 May 20 16:01 my_log.2016-05-20-1 > -rw-r--r--. 1 tomcat tomcat 124939 May 20 16:06 my_log.2016-05-20-2 > -rw-r--r--. 1 tomcat tomcat 90747 May 20 16:13 my_log.2016-05-20-3 > -rw-r--r--. 1 tomcat tomcat 158209 May 20 16:22 my_log.2016-05-20-4 > -rw-r--r--. 1 tomcat tomcat 137254 May 20 16:40 my_log.2016-05-20-5 > -rw-r--r--. 1 tomcat tomcat 42116 May 20 16:51 my_log.2016-05-20-6 > -rw-r--r--. 1 tomcat tomcat 1045354 May 20 23:56 my_log.2016-05-20-7 -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org