Wildfly - 登录到一个文件 [英] Wildfly - logging into one file
问题描述
似乎我的 wildfly 服务器每天都会生成单独的日志文件:比如server.log.2017-06-30 server.log.2017-07-06
.是否可以将其登录到一个(始终相同)文件中?
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?
推荐答案
默认情况下,WildFly 被配置为使用每天轮换的 periodic-rotating-file-handler
.如果你不想日志轮换,你可以使用 file-handler
代替.
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.
以下 CLI 命令将更改为使用 file-handler
.
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
要注意的一个属性是 append
属性.我已将其设置为 true
以便在重新启动或执行此命令时不会丢失任何日志消息.如果您不担心丢失日志消息,您可以将其设置为 false
.
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
.
这篇关于Wildfly - 登录到一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!