Websphere Liberty 中的每日滚动日志文件 (16.0.0.4-WS-LIBERTY-CORE)

Daily rolling log file in Websphere Liberty (16.0.0.4-WS-LIBERTY-CORE)

如何在 Websphere Liberty 中创建每日滚动日志文件?我希望日志文件的名称具有 YYYYMMDD 格式。

目前我只能限制最大文件大小、最大文件和 messages.log 的静态命名并禁用控制台日志。

 <logging consoleLogLevel="OFF" maxFileSize="1" maxFiles="3" messageFileName="loggingMessages.log"/>

https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/rwlp_logging.html

可能不是您想要的答案,但如果您重新启动服务器,它将滚动日志。

WebSphere Liberty 目前无法像传统 WAS 那样安排日志文件轮换。您可以使用 RFE site.

请求此功能

或者,您可以使用 Bruce 提到的方法 - 也许使用 cron 作业在午夜重新启动服务器。

您还可以考虑配置 Liberty 的 binary logging. This will create a binary log file that can be queried to produce actual log files (with filtering options, etc.). It does have some time-based options. More info here

安迪,希望这对你有所帮助