tags:

views:

26

answers:

1

Hi

I am using log4j with RollingFileAppender and also triggeringPolicy with SizeBasedTriggeringPolicy.log file is splited but one file split on size 11kb but other can grow without spliting when it reach the given size and also give wrning message "log4j:WARN Failure in post-close rollover action".i could not able to solve the problem.my lo4j.xml file consists the following configuration:

   <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

   <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
   <appender class="org.apache.log4j.rolling.RollingFileAppender" name="FixedWindowRollingFile">
   <param name="Append" value="true"/>
   <param name="ImmediateFlush" value="true"/>

   <rollingPolicy class="org.apache.log4j.rolling.FixedWindowRollingPolicy">
  <param name="fileNamePattern" value="E:/BonitaMQ_workflow/RequestHandlerService/logs/log_%i.log"/>
   <param name="minIndex" value="1"/>
   <param name="maxIndex" value="1"/>
   </rollingPolicy>
  <triggeringPolicy class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy">
 <param name="MaxFileSize" value="10240"/>
   </triggeringPolicy>
  <layout class="org.apache.log4j.PatternLayout">
 <param name="ConversionPattern"  value="%d{MMM,dd yyyy h:mm:ss a } %p %c{1}:%L - %m%n"/>
 </layout>
 </appender>


 <logger name="com.bonitaservice" additivity="false" >
  <level value="INFO" />
  <appender-ref ref="FixedWindowRollingFile"/>
  </logger>

<root>
<priority value="Debug"/>
<appender-ref ref="FixedWindowRollingFile"/>
</root>
</log4j:configuration>

please help me solve this problem.

Thanks

A: 

I had the same problem. I did not investigate it fully but believe it is caused by the fact that FixedWindowRollingPolicy always rotates at least once, which means there is always an index 1 and an index 2. In your case a log_1.log and a log_2.log, even if your MaxIndex is set to 1.

In my case, increasing maxIndex to 2 solved the problem.

Cheers, ED

Erik Dielen
i am try what u suggested but it not works for me.yet my problem is persist.
sam