Jboss Server Log Retention
search cancel

Jboss Server Log Retention


Article ID: 38289


Updated On:


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



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



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


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.


Release: ACP1M005900-12.9-Privileged Identity Manager