Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you configure rolling logs with wildfly

Tags:

wildfly

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.

like image 624
user301693 Avatar asked Dec 27 '25 18:12

user301693


1 Answers

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
like image 138
James R. Perkins Avatar answered Dec 31 '25 00:12

James R. Perkins