Use cronolog to split Tomcat's Catalina. Out File
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, you need to do the following:
Modify the Java code in the Catalina. Sh file under the Tomcat bin directory
- Org. Apache. Catalina. startup. Bootstrap "$ @" Start \
- > "$ Catalina_base"/logs/Catalina. out 2> & 1 &
Is
Java code
- 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 in the file
Java code
- Touch "$ catalina_base"/logs/Catalina. Out
You can comment it out and restart tomcat,
Check whether catalina.2009-07-01.out logs exist in the logs file.