how to configure wildfly server.log to have a fixed size and rotate daily and keep only logs for 5 days.?

1.8k views Asked by At

snippet from standalone.xml,

**below configuration is not yielding the result.

<file relative-to="jboss.server.log" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<rotate-size value="500m"/>
<append value="true"/>
<max-backup-index value="5"/>
2

There are 2 answers

0
James R. Perkins On

The periodic-size-rotating-file-handler does not purge backups when the suffix attribute is used. See the Wildscribe documentation. This has been requested, but there is not really a good way to determine which files would need to be purged.

0
HackerMonkey On

You might need to use the rotating file handler right from within your standalone.xml, like below:

<profile>
  <subsystem xmlns="urn:jboss:domain:logging:3.0">    
    <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>
  </subsystem>
</profile>