Shahid Majeed created LOG4J2-1992:
-------------------------------------

             Summary: RollingFileAppender violate maxfilesize limit.
                 Key: LOG4J2-1992
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1992
             Project: Log4j 2
          Issue Type: Bug
          Components: API, log4j 1.2 emulation
    Affects Versions: 2.0
         Environment: Linux, java
            Reporter: Shahid Majeed
             Fix For: 2.0


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

{code:java}
    <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>
{code}

During our test we have following file size of each backup

{noformat}
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
{noformat}

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.




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to