1 Reply Latest reply on May 21, 2012 2:17 AM by janejoy12

    Jboss 5.1.0 GA - Daily roll out of server.log, console log using Log4j DailyRollingFileAppender is not working.

    janejoy12 Newbie

      Hi Everyone,

       

      I have migrated my application server from Jboss 4.0.5 GA to Jboss 5.1.0 GA. I have Jboss5 configured as a windows service using 'service.bat' and 'jbosssvc.exe'.

      The logs are directed to the files 'server.log' (JBOSS_HOME\server\all\log) and run.log (JBOSS_HOME\bin - console log file).

      Since 'run.log' is created with a lock , i have redirected the console output to a new log file console.log in JBOSS_HOME\server\all\log.

       

      In production setup, i need both the log files ( server.log,console.log) to be backed up every day using DailyRollingFileAppender.

      This is fine with 4.0.5 version whereas it is not happening in 5.1.0 GA

      Please help to get this resolved.

       

      My Jboss-log4j.xml is as below, I have modified the 'CONSOLE'.  'FILE' appender remains the same.

      Thanks in advance.

       

      ===============================

      <!-- 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.log.dir}/server.log"/>

            <param name="Append" value="true"/>

            <!-- In AS 5.0.x the server log threshold was set by a system

                 property. In 5.1 and later we are instead using the system

                 property to set the priority on the root logger (see <root/> below)

            <param name="Threshold" value="${jboss.server.log.threshold}"/>

            -->

           

            <!-- Rollover at midnight each day -->

            <param name="DatePattern" value="'.'yyyy-MM-dd"/>

       

            <!-- Rollover at the top of each hour

            <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>

            -->

       

            <layout class="org.apache.log4j.PatternLayout">

               <!-- The default pattern: Date Priority [Category] (Thread) Message\n -->

               <param name="ConversionPattern" value="%d %-5p [%c] (%t) %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>

       

      <!-- ============================== -->

         <!-- Append messages to the console -->

         <!-- ============================== -->

       

          <appender name="CONSOLE" class="org.jboss.logging.appender.DailyRollingFileAppender">

            <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>

            <param name="File" value="${jboss.server.log.dir}/console.log"/>

            <param name="Threshold" value="INFO"/>

            <param name="Append" value="true"/>

            <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>

            <layout class="org.apache.log4j.PatternLayout">

            <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>

            </layout>

          </appender>