0

I have looked around and I havent been able to find a clear cut answer to how this can be configured. i read that the native logrotate is a bad idea. so is there a way to do this within the log4j configuration?

1 Answer 1

2

Do not use the native logrotate unless you want to zip your old files. Use the log4j facilities, in this specific case: org.jboss.logging.appender.DailyRollingFileAppender implementation.

Will use the param DatePattern to roll the logs daily or whatever you set it up to do http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html

   <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="File" value="${jboss.server.log.dir}/server.log"/>
      <param name="Append" value="true"/>
      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
      </layout>
   </appender>

then you use cron to gzip the logs as needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.