Split tomcat log under Linux system

Source: Internet
Author: User

Under the Linux system, the Tomcat log catalina.out will not be rewritten as a date under the Windows system, so the log file is too large under the Linux system, this article describes the use of Cronolog tools, such as the effect under window, To automatically split the log by date, the process is as follows:

1. In Linux installation Cronolog, the cronolog-1.6.2 version is used in this article

[Email protected] src]# tar zxvf cronolog-1.6.2.tar.gz

[Email protected] cronolog-1.6.2]#./configure

[[email protected] cronolog-1.6.2]# make && make install

2. Locate the Tomcat under Catalina.sh file and edit the changes

[Email protected] bin]# VI catalina.sh

shift Touch "$CATALINA _out" if ["$" = "-security"], then If [$have _tty-eq 1], then echo "Using Securi Ty Manager "fi shift" $_runjava "" $LOGGING _config "$JAVA _opts $CATALINA _opts-djava.endorsed.dirs=" $JAVA _en Dorsed_dirs "-classpath" $CLASSPATH "-djava.security.manager-djava.security.policy==" $CATALINA _base "/conf/cat alina.policy-dcatalina.base= "$CATALINA _base"-dcatalina.home= "$CATALINA _home"-djava.io.tmpdir= "$CATALI Na_tmpdir "Org.apache.catalina.startup.Bootstrap" [email protected] "Start >> $CATALINA _out" 2>&1& Else "$_runjava" "$LOGGING _config" $JAVA _opts $CATALINA _opts-djava.endorsed.dirs= "$JAVA _endorsed_dir S "-classpath" $CLASSPATH "-dcatalina.base=" $CATALINA _base "-dcatalina.home=" $CATALINA _home "-djava.io.t Mpdir= "$CATALINA _tmpdir" org.apache.catalina.startup.Bootstrap "[email protected]" Start >> "$CATALINA _o UT "2>&1& Change to Shift touch "$CATALINA _out" if ["$" = "-security"], then If [$have _tty-eq 1]; then EC Ho "Using Security Manager" fi shift "$_runjava" "$LOGGING _config" $JAVA _opts $CATALINA _opts-djava.endorse d.dirs= "$JAVA _endorsed_dirs"-classpath "$CLASSPATH"-djava.security.manager-djava.security.policy== "$CATALIN A_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 |/USR/LOCAL/SBI N/cronolog "$CATALINA _base"/logs/catalina.%y-%m-%d.out >>/dev/null 2> &1 & Else "$_runjava" "$LOGGING _config" $JAVA _opts $CATALINA _opts-djava.endorsed.dirs= "$JAVA _end Orsed_dirs "-classpath" $CLASSPATH "-dcatalina.base=" $CATALINA _base "-dcatalina.home=" $CATALINA _home "-D Java.io.tmpdir= "$CATALINA _tmpdir" org.apache.catalina.startup.Bootstrap "[email protected]" Start |/usr/lo Cal/sbin/cronolog "$CATALINA _base"/logs/catalina.%y-%m-%d.out >>/dev/null 2> &1 &

3. Restart Tomcat with the following effect:

PS: Because do not know how to upload the attachment, Cronolog tool installation depends on the people to download their own

Split tomcat log under Linux system

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.