Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2121

DefaultRolloverStrategy max = 5 does not limit nuber of files

    XMLWordPrintableJSON

Details

    • Question
    • Status: Closed
    • Major
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Linux RedHat

    Description

      Dears,

      I have very simple configuration of the RollingFile appender

      <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>
      

      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?

      Thanks in advance for help.

      Attachments

        Activity

          People

            Unassigned Unassigned
            habdank Seweryn Habdank-Wojewodzki
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: