We are using wildfly and in our wildflyhome/standalone/log directory it's filling up with logs and eventually running out of disc space. I would like to set up rolling logs and know that it's possible but just don't know how to do it. Any help would be appreciated.
If you're on linux just setup a cron job to purge the files.
If you want to use a size rotation that will only keep as many rotations as you tell it you can use a size-rotating-file-handler.
The following CLI command will replace the default periodic-rotating-file-handler with a size-rotating-file-handler which rotates when the log file reaches 50MB and will only keep 10 rotations.
batch
/subsystem=logging/root-logger=ROOT:remove-handler(name=FILE)
/subsystem=logging/periodic-rotating-file-handler=FILE:remove
/subsystem=logging/size-rotating-file-handler=FILE:add(append=true, autoflush=true, named-formatter=PATTERN, max-backup-index=10, rotate-size=50m, file={relative-to=jboss.server.log.dir, path=server.log})
/subsystem=logging/root-logger=ROOT:add-handler(name=FILE)
run-batch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With