Rotating catalina.out log files

posted by SpringSource on June 28, 2010 09:58 AM

It is possible to rotate the catalina.out log, by using a log rotation program like rotatelogs or cronolog.

It is possible to rotate the catalina.out log, but it is not controlled by the standard or files.

The catalina.out log is stderr and stdout piped to a file. If you want to rotate this log file you will need to use a log rotation program like rotatelogs or cronolog. Then just pipe to the log rotation program rather than the file.

Here is an example of how to do this with cronolog. Using another program would be very similar, the command in step #3 would just be slightly different.

1.) Edit the bin/ file.

2.) Find the following line and comment it out.

touch "$CATALINA_BASE"/logs/catalina.out

Note that in later versions of Tomcat this may look like:


3.) Find the following line (there should be two instances of this line, replace both)

>> "$CATALINA_BASE"/logs/catalina.out 2>&1 &

and replace it with this line

2>&1 |/usr/bin/cronolog "$CATALINA_BASE/logs/catalina-%Y-%m-%d.out" &

Note that in later versions of Tomcat the line that needs to be replaced may look like:

>> "$CATALINA_OUT" 2>&1 &

4.) Save bin/

5.) Restart Tomcat.

You should now have a "catalina-2010-03-30.out" file in your logs directory. When the date changes a new log file will be created. The following day you should see "catalina-[following date].out".

Please note that the log file may not be rotated exactly at midnight. It will rotate the first time something is written to the log after the date has changed. This generally isn't a problem for busy log files.

For more than 10 years, SpringSource employees have been supporting Apache technologies, with unparalleled experience and commitment to the Apache Software Foundation. More than 400 of the Fortune 500 count on SpringSource to support their mission-critical business applications. Leaders of the Apache Software Foundation, including Board Members, work at SpringSource and dedicate a significant amount of time further developing the Apache Tomcat open source project. Over the last 2 years, 95% of the issues fixed in the Apache Tomcat project were fixed by SpringSource engineers. For more information on how SpringSource can help your enterprise, see the SpringSource website, or call 800/444-1935.


Using "2>&1 |/usr/bin/cronolog "$CATALINA_BASE/logs/catalina-%Y-%m-%d.out" &" means the tomcat pid file doesn't contains anymore the pid of the java process but the cronlog pid

I modify --- if

I modify

if [ ! -z "$CATALINA_PID" ]; then
$JAVA_HOME/bin/jps | grep "Bootstrap" | cut -d " " -f 1 > $CATALINA_PID
#echo $! > $CATALINA_PID

but a little ugly.

And as a windows service?

Is it possible to rotate stdout.log when running tomcat as a windows service? Is this possible? Regards, Martin

If using the TanukiSoft wrapper...

it is certainly possible; consult the docs at

logrotate can be used


RE: Rotating catalina.out log files

For Linux systems run a logrotate script and adjust the parameters as needed following logrotate man page. Set logrotate script to run via cron.daily program.

A few abbreviate decades

A few abbreviate decades back, appearance acclimated to Replica watches be all about cutting latest appearance clothes and accessories. The acceptation or analogue of appearance has afflicted with the access of time. Today, appearance is not just about cutting the a lot of 'in-trend' clothes and accessories; it is added about selecting those clothes and adornments which affect you and reflect your personality in a different way. Artist wrist watch is one such chic appearance at accent for women.Men wish to advertise these watches as a attribute for their status. If you are a appearance enthusiast, again absolutely you can acclaim the adorableness of Swiss watches. If you acquirement these watches from online stores, again it aswell reflects their popularity. It aswell provides a aristocratic chic blow of to your personality. Be it workplace, accidental fun evenings with accompany or an important academic dinner, a acute artist watch in one's duke extends your appearance caliber by leaps and bounds. Someone has accurately said, "what your abrasion is an addendum of your personality." If you accept to abrasion a designer, branded buy Replica watches watch, it absolutely conveys that you are a "cut aloft the rest."

You have simply explained how

You have simply explained how to rotate catalina.out log files. I think this is the only way to do so. That’s why I am going to follow this method. Digital Cinema Projection Glass Thank you very much for sharing this post here. Keep updating such new info!


hungry shark evolution hack So it is interesting and very good written and see what they think about other people. clash of clans triche

buy follower I am looking for

buy follower I am looking for and I love to post a comment that "The content of your post is awesome" Great work! best site to buy youtube views

Post new comment

This question is for testing whether you are a human visitor and to prevent automated spam submissions.