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

RollingFileAppender violate maxfilesize limit.

    XMLWordPrintableJSON

Details

    • Patch, Important

    Description

      Hi,
      I knew i am using very old version of log4j that is 1.2. However this version is in our production and we have some legacy issues as well to not upgrade to 2.

      We are facing a problem when we do some testing and see RollingFileAppender violate the maxfilesize we set in the xml.
      We set the following configuration

          <appender name="A-DEBUG" class="org.apache.log4j.RollingFileAppender">
              <param name="File" value="catalina.log" />
              <param name="Append" value="true" />
              <param name="MaxFileSize" value="10MB" />
              <param name="MaxBackupIndex" value="10" />
              <layout class="org.apache.log4j.PatternLayout">
                  <param name="ConversionPattern" value="%d{ISO8601} %-5p [%t] %c %x - %m%n" />
              </layout>
          </appender>
      

      During our test we have following file size of each backup

      home> ls -l 
      total 193600 
      rw-rr- 1 root root 2019717 Jul 20 15:05 catalina.log 
      rw-rr- 1 root root 10486005 Jul 20 15:05 catalina.log.1 
      rw-rr- 1 root root 100918934 Jul 20 15:05 catalina.log.10 <<-- 100 MB !!!
      rw-rr- 1 root root 10485820 Jul 20 15:02 catalina.log.2 
      rw-rr- 1 root root 10485920 Jul 20 14:59 catalina.log.3 
      rw-rr- 1 root root 10485952 Jul 20 14:56 catalina.log.4 
      rw-rr- 1 root root 10485784 Jul 20 14:53 catalina.log.5 
      rw-rr- 1 root root 10486011 Jul 20 14:50 catalina.log.6 
      rw-rr- 1 root root 10485854 Jul 20 14:47 catalina.log.7 
      rw-rr- 1 root root 10485813 Jul 20 14:44 catalina.log.8 
      rw-rr- 1 root root 10485859 Jul 20 14:41 catalina.log.9
      

      Once test case is end we check the file size again then all files are 10MB exactly.
      That means during test file grow morethan max size.

      Could you please help me how to fix this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            shahid.majeed Shahid Majeed
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: