Jefin Joy
Jefin Joy

Reputation: 33

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

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

Upvotes: 0

Views: 2155

Answers (2)

HackerMonkey
HackerMonkey

Reputation: 473

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>

Upvotes: 0

James R. Perkins
James R. Perkins

Reputation: 17780

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.

Upvotes: 0

Related Questions