First, make sure that you have installed the cronolog tool. If not, install it first ,:
Wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
The default installation path is/usr/local/sbin/cronolog.
Go to the bin directory of Tomcat and open Catalina. sh file, find the Tomcat startup line, or you can directly find Catalina. in general, we modify the content in the following line (because we generally do not run in-security conditions ).
Else
"$ _ Runjava" $ java_opts $ catalina_opts \
-Djava. endorsed. dirs = "$ java_endorsed_dirs"-classpath "$ classpath "\
-Dcatalina. base = "$ catalina_base "\
-Dcatalina. Home = "$ catalina_home "\
-Djava. Io. tmpdir = "$ catalina_tmpdir "\
Org. Apache. Catalina. startup. Bootstrap "$ @" Start \
> "$ Catalina_base"/logs/Catalina. out 2> & 1 &
If [! -Z "$ catalina_pid"]; then
Echo $!> $ Catalina_pid
Fi
Fi
Modify
Org. Apache. Catalina. startup. Bootstrap "$ @" Start \
> "$ Catalina_base"/logs/Catalina. out 2> & 1 &
Is
Org. Apache. Catalina. startup. Bootstrap "$ @" Start 2> & 1 \
|/Usr/local/sbin/cronolog "$ catalina_base"/logs/Catalina. % Y-% m-% d. Out>/dev/null &
At the same time, there is a line above
Touch "$ catalina_base"/logs/Catalina. Out
You can comment it out. After that, restart tomcat. the logs of catalina.2009-02-18.out are generated on a daily basis in the logs directory.