java - Log4J2 each log file keeps grows in the same size defined in log4j2.xml -


my current application on spring 3.2 / log4j2 2.3 / websphere 8.5 jdk6, have stick older version of log4j2 because application has stay jdk6.

now there interesting issue, seems caused configuration or bug in log4j2, each time when restart application server, rollingfile working in crazy mode, each new log file roll on grows in size of same size defined in sizebasedtriggeringpolicy. following log4j2.xml configuration:

<?xml version="1.0" encoding="utf-8"?> <configuration status="debug">     <properties>         <property name="log-path">c:/application/logs</property>     </properties>     <appenders>         <console name="stdout">             <patternlayout>                 <pattern>%p -- %c -- %m%n</pattern>             </patternlayout>         </console>         <rollingfile name="rollingfile" filename="${log-path}/application-l4j-haha.log"             filepattern="${log-path}/application-l4j-haha-%i.log">             <patternlayout>                 <pattern>%p -- %c -- %m%n</pattern>             </patternlayout>             <policies>                 <sizebasedtriggeringpolicy size="2 mb" />             </policies>             <defaultrolloverstrategy max="5" />         </rollingfile>     </appenders>     <loggers>         <logger name="root" level="debug" additivity="false">             <appenderref  ref="rollingfile" level="debug" />         </logger>         <root level="debug" additivity="false">             <appenderref  ref="rollingfile" />         </root>     </loggers> </configuration> 

so each file should maintain in 2mb , rotated in 5 files

here file output, apparent log file grows on each roll on , reach big size, , each new file bigger previous 1 in exact 2mb !

enter image description here

also interestingly happen when restart application. if remove log files , let log4j2 start scratch log file roll on expected, files in same size. if stop application server , start again log file goes crazy again.

also issue found not in websphere tomcat, guess not server issue.

is there known bug related issue , how fix it?


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -