0
votes

How to create a daily rolling log file in Websphere Liberty? I want the name of the log file to have YYYYMMDD format.

Currently I'm only able to limit the max file size, max file and a static naming of messages.log and disable consolelog.

 <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

2

2 Answers

1
votes

Probably not the answer you want, but if you restart the server it will roll the log.

1
votes

WebSphere Liberty does not currently have the ability to schedule log file rotation like traditional WAS. You can request this feature using the RFE site.

Alternatively, you could use an approach like Bruce mentioned - perhaps using a cron job to restart the server at midnight.

You might also consider configuring Liberty's 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.

Hope this helps, Andy