Raphael created LOG4J2-2501:
-------------------------------

             Summary: RollingFileAppender with SizeBasedTriggeringPolicy does 
not work properly with large size limits
                 Key: LOG4J2-2501
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2501
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.8.2
         Environment: Log4j v.2.8.2 with SLF4J v.1.7.21. Currently running Java 
version 1.8.0_161. 
            Reporter: Raphael
         Attachments: log4j2.xml

My application uses a RollingFileAppender with a SizeBasedTriggeringPolicy in 
which logs should roll over once they reach 50MB in size. However, if the logs 
exceed this size while the application is running they do not roll over. Only 
when the application is restarted do the logs get rolled over if they are too 
big. 

 

If the size limit is set to 50KB, or 5MB, the rolling over works fine. It seems 
like only for large size limits like 50MB that this problem occurs. I've 
attached my log4j2.xml config file to this issue. 


Here is a snippet containing the RollingFileAppender config: 
{code:xml}
<RollingFile
append="true"
name="rootfile"
fileName="/logs/root.log"
filePattern="/logs/root.%i.log">
  <DefaultRolloverStrategy fileIndex="min" max="10"/>
  <Policies>
    <SizeBasedTriggeringPolicy size="50000 KB"/>
  </Policies>
  <PatternLayout pattern="[%d{ISO8601}]%5p[%t]%x - %C.%M(%F:%L) - %m%n"/>
</RollingFile>
{code}



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

Reply via email to