Splitting Tomcat's Catalina. Out log file in Linux

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.