I have a default tomcat 9.0.37 installation. The catalina.out file in the server logs does not roll on a daily basis due to which its size has grown to several GBs.
However I observed that a file with the name pattern catalina.yyyy-mm-dd.log keeps generating but does not contain the complete logs for that day.
I already tried the following approaches as suggested in some blogs but all in vain.
1. Logrotate
Created a file with the name tomcat and pasted the following code in it.
/home/tomcat/servers/tomcat/logs/catalina.out {
daily
rotate 30
missingok
dateext
compress
notifempty
copytruncate
size 20M
}
2. logging.properties
Changed
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
to
.handlers = 1catalina.org.apache.juli.FileHandler
in conf/logging.properties
file.
Can anyone suggest me how to roll out daily logs from catalina.out?