简体   繁体   中英

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

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM