Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Abandoned
-
2.8.2
-
None
-
None
-
Log4j v.2.8.2 with SLF4J v.1.7.21. Currently running Java version 1.8.0_161.
Description
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:
<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>