Reputation: 1
Can some one help me in creating log files based on size?
Here is the XML I am using. But this is not working as expected.
The file engine.log
is getting deleted as soon as the file size reaches 1KB and a new file with same name is created.
But the old file should be renamed as engine1.log
or something like that.
<!-- A size based file rolling appender -->
<appender name="Engine" class="org.jboss.logging.appender.RollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="File" value="${jboss.server.log.dir}/archivist/engine/engine.log"/>
<param name="Threshold" value="DEBUG"/>
<param name="Append" value="false"/>
<param name="MaxFileSize" value="1KB"/>
<param name="MaxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
Upvotes: 0
Views: 472
Reputation: 169
Please try the conversion pattern:
<param name="ConversionPattern" value="%d %-5p [%c{1}] %m %n" />
Upvotes: 2
Reputation: 2635
Can you try to omit this line from your config:
<param name="Append" value="false"/>
Upvotes: 0