Alternative Log Rotation Triggers
WildFly allows a rotating file handler to be defined in other ways as well. You can configure it to allow a specified number of log files to be retained that are of a specific age.
A periodic rotating file handler can be used to rotate/renew the log file at a specified frequency as defined by the <suffix> element shown below.
The following example illustrates the configuration for a daily Change log rotation:
<periodic-rotating-file-handler name="INSIGHT_DATA_CHANGE_FILE"> <file relative-to="jboss.server.log.dir" path="insight-data-changes.log"/> <formatter> <pattern-formatter pattern="%d{HH:mm:ss,SSS} %s%E%n"/> </formatter> <suffix value=".yyyy.MM.dd"/> <append value="true"/> </periodic-rotating-file-handler>
The configuration can be changed to rotate the log file hourly:
<suffix value=".yyyy.MM.dd.HH"/>
For more information about the WildFly rotating log file and other configuration options, visit https://docs.wildfly.org/21/wildscribe/subsystem/logging/periodic-size-rotating-file-handler/index.html.