Java Mailing List Archive

http://www.java2.5341.com/

Home » Log4J Users List »

problem about log4j config when a program is reading this log

yunbinwang@travelsky.com

2013-06-02


Author LoginPost Reply
Hi
I configure log4j so that when log size is beyong some value, the log will generate a new one.
config file like this, it works well when no other program reading this log.

but when a program is reading this log, it seems log can't generate a new one even it reach the max size.
this reading program is scanning the error keywords from log , like a monitor .

<appender name="DAILY_ALARM" class="org.apache.log4j.RollingFileAppender">
 <param name="MaxFileSize" value="5KB" />
<param name="MaxBackupIndex" value="2" />
 <param name="File" value="./logs/alarm.log" />
 <layout class="org.apache.log4j.PatternLayout">
  <param name="ConversionPattern"
  value="[%-d{yyyyMMdd HH:mm:ss.SSS}] [%-5p]%m%n"/>
 </layout>
 <filter class="org.apache.log4j.varia.LevelRangeFilter">
  <param name="LevelMin" value="WARN" />
  <param name="LevelMax" value="FATAL" />
 </filter>
</appender>

Is there some way to avoid this condition?
©2008 java2.5341.com - Jax Systems, LLC, U.S.A.