Use Crontab to automatically split tomcat logs

Source: Internet
Author: User


using Cronolog for log cutting
1. Download (latest Version)
# wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
2. Decompression
# tar zxvf cronolog-1.6.2.tar.gz
3. Enter the directory where the Cronolog installation files are located
# CD cronolog-1.6.2
4. Run the installation
#./configure
# make
# make install
5. Enter the Tomcat bin directory, open the catalina.sh file, and locate the associated line for Tomcat startup. Or if you look directly at catalina.out, generally we modify the contents of the following line (because we generally do not run under-security conditions),

Will:

If [-Z "$CATALINA _out"]; Then

catalina_out= "$CATALINA _base"/logs/catalina.out

Fi


Modified to:

If [-Z "$CATALINA _out"]; Then

catalina_out= "$CATALINA _base"/logs/catalina.%y-%m-%d.log

Fi


Comment out: Touch "$CATALINA _out"

#touch "$CATALINA _out"


Will:

Shift

"$_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 "[email protected]" start \

>> "$CATALINA _out" 2>&1 &

Modified to:

"$_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 "[email protected]" Start 2>&1 \

|/usr/local/sbin/cronolog "$CATALINA _out" >>/dev/null &


Will:

Else

"$_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 "[email protected]" start \

>> "$CATALINA _out" 2>&1 &

Modified to:

Else

"$_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 "[email protected]" Start 2>&1 \

|/usr/local/sbin/cronolog "$CATALINA _out" >>/dev/null &


6. After modifying the restart Tomcat service, you can


This article is from the "Free Sky" blog, please be sure to keep this source http://tongweibo.blog.51cto.com/1499640/1697362

Use Crontab to automatically split tomcat logs

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.