You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ian Pickering (JIRA)" <ji...@apache.org> on 2019/04/25 20:25:00 UTC

[jira] [Created] (LOG4J2-2595) Max file count with DefaultRolloverStrategy is never reached if a numbered log greater than the maximum exists in the same directory

Ian Pickering created LOG4J2-2595:
-------------------------------------

             Summary: Max file count with DefaultRolloverStrategy is never reached if a numbered log greater than the maximum exists in the same directory
                 Key: LOG4J2-2595
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2595
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.11.2, 2.11.1
            Reporter: Ian Pickering


We are encountering an issue where only one log file is ever rolled over to, as if it is being overwritten on every rollover, if a log file with a number greater than the maximum specified in the DefaultRolloverStrategy exists in the same folder. Consider the following configuration.

{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
  <Appenders>
    <RollingRandomAccessFile name="file" fileName="logs\test.log" filePattern="logs\test.log.%i"
                             append="true" immediateFlush="true">
      <Policies>
        <SizeBasedTriggeringPolicy size="200MB"/>
      </Policies>
      <DefaultRolloverStrategy max="10"/>
      <PatternLayout pattern="%d{ISO8601} %-5p [%T] %c{1}: %m%n"/>
    </RollingRandomAccessFile>
  </Appenders>
  <Loggers>
    <Root level="debug">
      <AppenderRef ref="file"/>
    </Root>
  </Loggers>
</Configuration>
{code}

Here the number is appended to the end of the log. If the log output directory has these files:

{code}
04/25/2019  13:19       111,370,590 test.log
04/25/2019  13:19       209,715,426 test.log.10
04/25/2019  13:15        20,971,782 test.log.12331
{code}

then only test.log and test.log.10 will be written to. No other files will ever be created no matter how many times that test.log is rolled over. The expected behavior is for all the files from 1-10 to be created eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)