Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.