1 Reply Latest reply on Sep 29, 2010 12:28 PM by peterj

    Forcing server.log rotation

    acc01

      Hi,

       

      We have set out appender  in log4j to:

      [CODE]<!-- A time/date based rolling appender -->
         <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
           <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
           <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
           <param name="Append" value="true"/>
          
           <!-- 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"/>
          
              <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
              <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
              -->
            </layout>
          </appender>

      [/CODE]

       

       

      How can we force server.log to be rotated during the day incase the logs reach a large size or for any other reason? We are using JBoss AS4. I have tried setting the append value to false and going through jmx-xonsole to invoke reconfigure() but dont see any results. Is there another way of forcing log rotation?

       

      Thanks

        • 1. Re: Forcing server.log rotation
          peterj

          Use the RollingFileAppender instead and set the maxFileSize param.

           

          And no, there is no way to have both the DaillyRollingFileAppender (new log file each day) and RollingFileAppender (new log file once it reaches a certain size) behavior unless you write your own appender.