Wildfly - logging into one file

自闭症网瘾萝莉.ら 提交于 2019-12-12 04:11:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!