catalina.out log rotation



I am interested in catalina.out log file rotation, I have an application where logging to catalina.out is very huge, say 0.5 MB / sec.

So I have written one script to handle this which is shown below.


# crontab -l | grep catalina

0,30 * * * * bash /  >/dev/null 2>&1


# more /




$CATLOC /catalina.out >> /catalina_backup.out à take a backup and then handle this file rotation using logadm

$SEDLOC '' catalina.out > catalina.out à Empty this file


There are two cases here


1.)     The below is normal behavior where not much logging

# ls -ltrh catalina*

-rw-r-----   1 ems      ems          15K Jan 31 12:07 catalina.2012-01-31.log

-rw-r-----   1 ems      ems         3.9K Feb  1 06:26 catalina.2012-02-01.log

-rw-r-----   1 ems      ems         345K Feb  1 06:45 catalina.out

-rw-r--r--   1 root     root         14M Feb  1 07:00 catalina_backup.out


2.)    The below is heavy logging behavior

# ls -ltrh catalina*

-rw-r-----   1 ems      ems         4.2K Jan 28 22:14 catalina.2012-01-28.log à why I am seeing catalina file with date, have the same content as catalina.out

-rw-r-----   1 ems      ems          362 Jan 30 06:30 catalina.2012-01-30.log

-rw-r-----   1 ems      ems          10M Jan 30 14:43 catalina.out.2

-rw-r--r--   1 root     root        1.7M Jan 30 17:00 catalina_backup.out.9.gz

-rw-r--r--   1 root     root        1.6M Jan 30 20:00 catalina_backup.out.8.gz

-rw-r--r--   1 root     root        1.6M Jan 30 23:00 catalina_backup.out.7.gz

-rw-r--r--   1 root     root        1.6M Jan 31 02:00 catalina_backup.out.6.gz

-rw-r-----   1 ems      ems         113M Jan 31 03:30 catalina.out.3

-rw-r--r--   1 root     root        1.8M Jan 31 06:00 catalina_backup.out.5.gz

-rw-r-----   1 ems      ems         6.2M Jan 31 10:04 catalina.out

-rw-r-----   1 ems      ems         4.5K Jan 31 10:04 catalina.2012-01-31.log

-rw-r--r--   1 root     root        1.8M Jan 31 10:30 catalina_backup.out.4.gz

-rw-r--r--   1 root     root        1.8M Jan 31 15:00 catalina_backup.out.3.gz

-rw-r--r--   1 root     root        1.8M Jan 31 19:30 catalina_backup.out.2.gz

-rw-r--r--   1 root     root        1.8M Feb  1 00:00 catalina_backup.out.1.gz

-rw-r--r--   1 root     root         12M Feb  1 01:00 catalina_backup.out

-rw-r-----   1 ems      ems          12M Feb  1 01:12 catalina.out.1 à why this is latest file ? Is this because of huge logging, Can I disable default catalina.out rotation so that my script will take care of moving the content from catalina.out to catalina_backup.out…




Your urgent reply is appreciated.

asked by akshay_tomcat


The catalina.out file is created by a shell redirection, ex ">> catalina.out 2>&1".  This catches anything written to System.out and System.err and places it into the catalina.out file. 

Given this, a good way to rotate catalina.out is to alter the script to pipe the output to a log rotation script rather than directly to a file.  This will allow you to rotate the logs without restarting Tomcat and without copying the entire contents of the log to another file.

It's a pretty simple change to and it is described at this link.



answered by dmikusa on February 20, 2012 08:27 AM

Daniel Mikusa is a Software Support Engineer at Pivotal.  Daniel has been a user of Apache Tomcat for the past six years and is currently focused on providing enterprise-class support for Pivotal's Tomcat and tc Server customers. Daniel attended college at Kent State University and holds a bachelor's degree in Computer Science.


On this subject internet

On this subject internet page, you'll see my best information, be sure to look over this level of detail. Chandler Blinds

I should say only that its

I should say only that its awesome! The blog is informational and always produce amazing things. Phoenix Blinds

Very good topic, similar

Very good topic, similar texts are I do not know if they are as good as your work out. Gilbert Kitchen Remodeling

Awesome dispatch! I am indeed

Awesome dispatch! I am indeed getting apt to over this info, is truly neighborly my buddy. Likewise fantastic blog here among many of the costly info you acquire. Reserve up the beneficial process you are doing here. Chandler Kitchen Remodeling

So it is interesting and very

So it is interesting and very good written and see what they think about other people. Mesa Kitchen Remodeling

Make the most of mainly

Make the most of mainly premium substances - you will find him or her for: happy new year

I encourage you to read this

I encourage you to read this text it is fun described ... locksmith in coral springs florida


subscribers This is very appealing, however , it is very important that will mouse click on the connection: get youtube views

It has fully emerged to crown

It has fully emerged to crown Singapore's southern shores and undoubtedly placed her on the global map of residential landmarks. I still scored the more points than I ever have in a season for GS. I think you would be hard pressed to find somebody with the same consistency I have had over the years so I am happy with that. voyance gratuite en ligne

The most interesting text on

The most interesting text on this interesting topic that can be found on the net ... fat diminisher review

For true fans of this thread

For true fans of this thread I will address is a free online! Language of Desire Product

This script is good but I

This script is good but I don’t think you need to write this big one to complete your task. As research paper service reviews says the more the loops or conditions you keep the interpreter will more time to complete the loop. Try making it short and using less loops and conditioning so that the work will complete fast and get result to you and you easily upload your file if it is huge also.

Twitter Followers | Twitter Retweet

how to gain more followers on twitter Within this webpage, you'll see the page, you need to understand this data. how to get favorites back


This post that explains on the catalina.out log file in the Tomcat server proved to be an interesting one. The post helped me to understand more on the file and the log rotation details. Keep up the good show Man bun

castle clash gems I read this

castle clash gems I read this article. I think You put a great deal of exertion to make this article. I like your work. coc cheats deutsch


For some reason I feel that this update has not taken effect in my system. Me along with one of my close friends where working of something similar for our project and we kind of messed it up big time. bee suits

get followers on

get followers on twitter Truly, this article is really one of the very best in the history of articles. I am a antique ’Article’ collector and I sometimes read some new articles if I find them interesting. And I found this one pretty fascinating and it should go into my collection. Very good work! buy youtube views cheapest

tomcat stops writing to catalina.out, why?

I have a UI web application. Whenever I have gone a few days without restarting the gui, tomcat stops logging to catalina.out. In fact not only does it stop logging, it empties whatever log output exists in catalina.out, catalina.out.1 and catalina.out.2. If the gui is restarted tomcat will begin logging again.

Steps to Reproduce:
1. Let the web ui run on for a few days without restarting the system or the gui. The UI's server component writes to the log.
2. After a couple of day tomcat stops logging to catalina.out. All three files (catalina.out, catalina.out.1 and catalina.out.2) will be empty.

Any help or hint as why this is happening is appreciated beyond words can express.

Post new comment

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