Log cutting management for Tomcat under Linux

Source: Internet
Author: User

For Tomcat Log management, after the deployment of Tomcat, running long, catalina.out files will become larger, the stability of the system has a certain impact.

1 You can modify the Conf/logging.properties log profile to block out this part of the log information.

Vim/data/ifengsite/java/tomcat/conf/logging.properties

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5C/99/wKioL1UeQRri18KgAAD3ZhtOPdo489.jpg "title=" Fineqq20150403152047.png "alt=" Wkiol1ueqrri18kgaad3zhtopdo489.jpg "/>

Setting the level to warning can reduce the output of the log a lot, or set it directly to off and disable it directly.

The general log levels are:

SEVERE (highest value) > WARNING > INFO > CONFIG > FINE > Finer > FINEST (lowest value)


2 Using the Cronolog tool to slice Tomcat's catalina.out log files

Download install 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5C/9D/wKiom1UeQLLDEVzhAACUjfEK8Hk925.jpg "title=" Xiazaiqq20150403152617.png "alt=" Wkiom1ueqlldevzhaacujfek8hk925.jpg "/>

./configuer--prefix=/usr/local/cronolog

Make && make install

Modify 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5C/9E/wKiom1UeQWPTb5LTAAB3M0JL5ZY385.jpg "title=" Xiugaiqq20150403152844.png "alt=" wkiom1ueqwptb5ltaab3m0jl5zy385.jpg "/> 650" this.width=650; "src=" http:// S3.51cto.com/wyfs02/m00/5c/99/wkiol1uequyiv4zyaacbgx9b9hs042.jpg "title=" Zhushiqq20150403153025.png "alt=" Wkiol1uequyiv4zyaacbgx9b9hs042.jpg "/>

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

Modified to catalina_out= "$CATALINA _base"/logs/catalina.%y-%m-%d.out

650 this line) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5C/99/wKioL1UeRBGw4r1lAAAu2Iv9or8900.jpg "title=" Jia#qq20150403153513.png "alt=" Wkiol1uerbgw4r1laaau2iv9or8900.jpg "/> Add # Comment out

This line 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5C/9E/wKiom1UeQ3uROb_AAAB0xb0aJak611.jpg "title=" 390qq20150403153700.png "alt=" Wkiom1ueq3urob_aaab0xb0ajak611.jpg "/>

Revision changed to

Org.apache.catalina.startup.Bootstrap "[email protected]" Start 2>&1 \ | /usr/local/sbin/cronolog "$CATALINA _out" >>/dev/null & #/usr/local/sbin/cronolog cronolog installation path

650 this line) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5C/99/wKioL1UeRjGyhIgnAABZrRUvQ2Q291.jpg "title=" 420qq20150403154416.png "alt=" Wkiol1uerjgyhignaabzrruvq2q291.jpg "/>

Revision changed to

Org.apache.catalina.startup.Bootstrap "[email protected]" Start 2>&1 \

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


Restart Tomcat for the changes to take effect

This allows the/data/ifengsite/java/tomcat/logs to automatically generate Catalina.%y-%m-%d.out files every day, and then periodically cleans up the outdated files, which can be achieved by crontab.

Add a timed task Crontable-e


5 * * 6/bin/find/data/ifengsite/java/tomcat/logs-mtime +7-type f-name "Catalina.*.out"-exec/bin/rm-f {} \;


Log cutting management for Tomcat under Linux

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.