Jboss Server Log Retention

book

Article ID: 38289

calendar_today

Updated On:

Products

CA Virtual Privilege Manager CA Privileged Identity Management Endpoint (PIM) CA Privileged Access Manager (PAM)

Issue/Introduction

Question:

Is there a way to make my Jboss log's roll over automatically without having to administer these changes?
 

 

Answer: 

Yes, there's a way to append the Jboss server log's retention so that this can become an automated procedure.  The DailyRollingFileAppender doesn't give us the option
to specify how many files to keep and it doesn't clean up after itself.  But, you can use size appender along with MaxBackupIndex.
 
File: <JBOSS HOME DIR>\server\default\conf\jboss-log4j.xml
 
<!-- A size based file rolling appender  -->
  <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="File" value="${jboss.server.log.dir}/server.log"/>
      <param name="Append" value="false"/>
      <param name="MaxFileSize" value=" 10MB"/>
      <param name="MaxBackupIndex" value="20"/>
 
         <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
       </layout>        

 

 </appender>
 
Change the "Append" value to "true", and "MaxFileSize" to an appropriate value.  So in the example above, keep the current server.log until it hits the 10MB threshold, and keep 20 previous instances of it within the folder.  It's also recommended that you setup a Windows script or a *nix script to delete older log files.

Environment

Release: ACP1M005900-12.9-Privileged Identity Manager
Component: