Tomcat7 Catalina. Out log Segmentation

Source: Internet
Author: User

Recently, due to work requirements, the Catalina. Out file of Tomcat is constantly expanding, which leads to a smaller disk space edge and difficult to manage. Therefore, we want to use a tool to separate it. I found cronolog online.

The installation process is as follows:


Download (Latest Version)

# Wget http://cronolog.org/download/cronolog-1.6.2.tar.gz

2. Extract

# Tar zxvf cronolog-1.6.2.tar.gz

3. Go to the directory where the cronolog Installation File is located.

# Cd cronolog-1.6.2

4. Run and install

#./Configure

# Make

# Make install

5. Check the directory where cronolog is installed (verify that the installation is successful)

# Which cronolog

Usually:/usr/local/sbin/cronolog

To split Catalina. Out of Tomcat 7, you need to do the following:

Go to the bin directory of Tomcat and open the Catalina. Sh file. Generally, we modify the content in the following line (because we generally do not run it under-security conditions ),

(1) If [-z "$ catalina_out"]; then
Catalina_out = "$ catalina_base"/logs/Catalina. Out
Fi
Changed:
If [-z "$ catalina_out"]; then
Catalina_out = "$ catalina_base"/logs/Catalina. % Y-% m-% d. Out
Fi
(2) Touch "$ catalina_out"
If ["$1" = "-Security"]; then
If [$ have_tty-EQ 1]; then
Echo "using security manager"
Fi
Shift
Eval \ "$ _ runjava \" \ "$ logging_config \" $ logging_manager $ java_opts $ catalina_opts \
-Djava. endorsed. dirs = \ "$ java_endorsed_dirs \"-classpath \ "$ classpath \"\
-Djava. Security. Manager \
-Djava. Security. Policy ==\ "$ catalina_base/CONF/Catalina. Policy \"\
-Dcatalina. base = \ "$ catalina_base \"\
-Dcatalina. Home = \ "$ catalina_home \"\
-Djava. Io. tmpdir = \ "$ catalina_tmpdir \"\
Org. Apache. Catalina. startup. Bootstrap "$ @" Start \
> "$ Catalina_out" 2> & 1 "&"
Else
Eval \ "$ _ runjava \" \ "$ logging_config \" $ logging_manager $ 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_out" 2> & 1 "&"

Fi

If [! -Z "$ catalina_pid"]; then
Echo $! > "$ Catalina_pid"
Fi
Changed:
# Touch "$ catalina_out"
If ["$1" = "-Security"]; then
If [$ have_tty-EQ 1]; then
Echo "using security manager"
Fi
Shift
Eval \ "$ _ runjava \" \ "$ logging_config \" $ logging_manager $ java_opts $ catalina_opts \
-Djava. endorsed. dirs = \ "$ java_endorsed_dirs \"-classpath \ "$ classpath \"\
-Djava. Security. Manager \
-Djava. Security. Policy ==\ "$ catalina_base/CONF/Catalina. Policy \"\
-Dcatalina. base = \ "$ catalina_base \"\
-Dcatalina. Home = \ "$ catalina_home \"\
-Djava. Io. tmpdir = \ "$ catalina_tmpdir \"\
Org. Apache. Catalina. startup. Bootstrap "$ @" Start 2> & 1 \
|/Usr/local/sbin/cronolog "$ catalina_out">/dev/null &
Else
Eval \ "$ _ runjava \" \ "$ logging_config \" $ logging_manager $ 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 2> & 1 \
|/Usr/local/sbin/cronolog "$ catalina_out">/dev/null &

Fi

If [! -Z "$ catalina_pid"]; then
Echo $! > "$ Catalina_pid"
Fi


 

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.