4

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?

Piotr P. Karwasz
  • 12,857
  • 3
  • 20
  • 43
Bhagyesh Jain
  • 323
  • 2
  • 10
  • The solutions you cite together decrease the amount of logs in `catalina.out` and rotate the file daily. Can you explain exactly what other solution are you looking for? – Piotr P. Karwasz May 08 '22 at 20:16
  • 2
    The solution that I'm looking is to have daily logs of catalina.out be rolled out to the respective log file so that the catalina.out file consists of the present day logs only. However, I observed that the date specific log file gets created but it does not consists of the entire catalina logs for that day. The logs keeps appending to the catalina.out file due to which its size keeps on increasing. Hope this clarifies my problem. – Bhagyesh Jain May 10 '22 at 08:31

0 Answers0