What is a rollingfile appender ?
I want my jboss to delete logs either exceeding a maximum size or exceeding a certain date. People on this forum have suggested me to use rollingfile appender.
How do I configure it in jboss-log4j.xml file ?
What is a rollingfile appender ?
I want my jboss to delete logs either exceeding a maximum size or exceeding a certain date. People on this forum have suggested me to use rollingfile appender.
How do I configure it in jboss-log4j.xml file ?
Here is an example:
<!-- A time/date based rolling appender -->
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="server.log"/>
<param name="Append" value="false"/>
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
Btw this is taken from our server's jboss-log4j.xml file - if you check your default server installation, I am fairly sure you find a similar configuration there ;-) Moreover, I guess if you add
<param name="MaxFileSize" value="100KB"/>
to the above, you get it roll over upon reaching the specified size.
For more info on appenders, see the Log4J manual.