1 Reply Latest reply on Aug 20, 2015 1:08 PM by James Perkins

    Custom-handler does not append the log each time jboss restart, but truncate the log

    redtea xixi Newbie

      I configured a PeriodicSizeRotatingFileHandler, every time I restarted jboss, the old content in jboss.log got cleared, new log was written into jboss.log at the first line, although append is set to "true". I am using Jboss EAP 6.4.0.GA and jboss-logmanager-1.5.4.Final.jar. The standalone.xml looks like below with the custom handler configuration,

      <subsystem xmlns="urn:jboss:domain:logging:1.5">

                 ...

                  <periodic-rotating-file-handler name="FILE" autoflush="true">

                      <formatter>

                          <named-formatter name="PATTERN"/>

                      </formatter>

                      <file relative-to="jboss.server.log.dir" path="server.log"/>

                      <suffix value=".yyyy-MM-dd"/>

                      <append value="true"/>

                  </periodic-rotating-file-handler>

                  <custom-handler name="VBO_ALL" class="org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler" module="org.jboss.logmanager">

                      <level name="TRACE"/>

                      <formatter>

                          <pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>

                      </formatter>

                      <properties>

                          <property name="fileName" value="${jboss.server.log.dir}/vbo/jboss.log"/>

                          <property name="rotateSize" value="100000000"/>

                          <property name="suffix" value=".yyyy-MM-dd"/>

                          <property name="maxBackupIndex" value="10"/>

                          <property name="append" value="true"/>

                          <property name="autoFlush" value="true"/>

                      </properties>

                  </custom-handler>

        • 1. Re: Custom-handler does not append the log each time jboss restart, but truncate the log
          James Perkins Master

          The is the order the properties are defined. You need to define the append and autoFlush before you define the fileName. If you already booted the server with this configuration you'll also need to fix the logging.properties file as well. You can either delete the reference to your handler or move the handler.VBO_ALL.properties values around to have append and autoFlush at the beginning.

           

          That said in EAP 6.4 there is a periodic-size-rotating-file-handler resource you can use instead of defining it as a custom-handler.

           

          --

          James R. Perkins