问题
It seems my wildfly server produces separate log file for each day: like
server.log.2017-06-30 server.log.2017-07-06
. Is it possible to make it logging into one (always same) file?
回答1:
By default WildFly is configured to use a periodic-rotating-file-handler
which rotates every day. If you don't want log rotation you can use a file-handler
instead.
The following CLI commands will make the change to using a file-handler
.
batch
/subsystem=logging/root-logger=ROOT:remove-handler(name=FILE)
/subsystem=logging/periodic-rotating-file-handler=FILE:remove
/subsystem=logging/file-handler=FILE:add(named-formatter=PATTERN, append=true, autoflush=true, file={relative-to=jboss.server.log.dir, path=server.log})
/subsystem=logging/root-logger=ROOT:add-handler(name=FILE)
run-batch
One attribute to note is the append
attribute. I've set it to true
so that you won't lose any log messages on a reboot or when this command is executed. If you're not concerned about losing log messages you could set it to false
.
来源:https://stackoverflow.com/questions/45037618/wildfly-logging-into-one-file