2 Replies Latest reply on Mar 2, 2011 2:54 PM by Peter Johnson

    Configuring gmt timestamp on log4j

    Diego Dias Newbie

      I am trying to configure my logs with GMT timetamps instead of local timestamps.

       

      My appender is

       

      <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"/>
      
            <!-- 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] 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>
      

       

      I have tried changing

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

      to

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

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

       

      but both didn't work.

       

      How can I do it just changing the conf of jboss-log4j.xml?