1 Reply Latest reply on Jun 22, 2014 3:03 AM by lokesh tarley

    max-backup-index configuration for cleanup old log files

    lokesh tarley Newbie

      1) I am using WildFly-8.0.0-Final(domain mode) ..and I need to control the maximum amount of server.log files and disk space through jboss logging framework...

      i noticed   "periodic-rotating-file-handler" is a default handler configured in the domain.xml file..i am happy with this handler but i have noticed "periodic-rotating-file-handler" doesn't support "max-backup-index" , so,  it will not controlled the no. of log files ? ..

       

      a) Is there any turnaround to configure "max-backup-index" in the "periodic-rotating-file-handler" ?

       

      2) Then i configured custom-handler as mention below: (from domain.xml file)

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

                          <properties>

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

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

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

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

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

                          </properties>

                      </custom-handler>

       

      from logging.properties file

      # Custom handler configuration

      handler.FILE=org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler

      handler.FILE.level=INFO

      handler.FILE.properties=autoFlush,fileName,append,suffix

      handler.FILE.constructorProperties=fileName,append

      handler.FILE.autoFlush=true

      handler.FILE.append=true

      handler.FILE.suffix=.yyyy-MM-dd

      handler.FILE.fileName=${org.jboss.server.log.file:server.log}

      handler.FILE.formatter=PATTERN

       

      The problem i had faced here is ...

      As i set "maxBackupIndex" value="5" , after restarting the server ..i find , last 5 days logs were deleted...

      what i understood from maxBackupIndex" is :- "it will keep the logs file with respect to its value" , in this case it should keep last 5 days log files and the files older than 5 days should be deleted ..please correct me ?

       

      Can you please help me to configure periodic-rotating-file-handler" with  "max-backup-index or some other alternative ...

      from the application end we are using "SLF4J" log utility backed by logback..