I think I have a problem with log4j. I am trying to enable bufferedio, but the default buffer size of 8K is too large for my current needs.
<appender name="MyAppender" class="org.apache.log4j.FileAppender"> <param name="bufferedIO" value="true"/> <param name="bufferSize" value="512"/> <param name="Append" value="true"/> <param name="File" value="C:/MyMonitor.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{dd/MM/yyyy HH:mm:ss}|%m%n"/> </layout> </appender> <logger name="com.mypackage.MyMonitor"> <level value="debug"/> <appender-ref ref="MyAppender"/> </logger>
I tried different sizes for the buffer, but writing to the file occurs only when the buffer reaches 8 KB.
I cannot find an error in Log4J describing this problem, even when I could find another guy who had the same problem (without any solution).
Turning on Log4J debugging shows that my appender has proper buffering, so I think no one overwrites my configuration.
Any idea what I'm doing wrong? Is this really a bug or limitation in Log4J?
Thanks.
source share