TomcatExpert

catalina.out log rotation

 

Hi,

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 /catalina_log_handler.sh  >/dev/null 2>&1

 

# more /catalina_log_handler.sh

#!/bin/sh

CATLOC=/bin/cat

SEDLOC=/usr/bin/sed

$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

question

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 catalina.sh and it is described at this link.

    http://marc.info/?l=tomcat-user&m=105640876032532&w=2

 

answer

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.

Comments

download full hd movies

here is the best collection of movies reviews and news
you may also watch and
download full hd movies

good night messages

Furniture Cyprus (Limassol,

Furniture Cyprus (Limassol, Nicosia, Paphos) by http://homedeco.com.cy/ is proud to offer a wide selection of unique and luxury furniture Furniture Cyprus

Taxi Paphos (in Cyprus) consists of a fleet of taxis, wedding cars and limos. Taxi Paphos

Rent a car Larnaca

Rent a car Larnaca Cyprus ( by CosmosCarRentals.com ) offers reasonable rates, with NO hidden costs. Rent a car Larnaca

Taxi Paphos (in Cyprus) consists of a fleet of taxis, wedding cars and limos. Taxi Paphos

Taxi Paphos

Taxi Paphos (in Cyprus) consists of a fleet of taxis, wedding cars and limos. Taxi Paphos

Taxi Paphos (in Cyprus) consists of a fleet of taxis, wedding cars and limos. Taxi Paphos

Good post

I understand that you want to know about catalina.log file rotation. I tried your scripts. But the heavy out log is bothering me. This can be solved by making some changes in the script. I hope your problem is solved by now. directv select package

deb

Very educating story, saved

Very educating story, saved your site for hopes to read more!
freemusicallyfollowers.iwantthis4free.com

Cyprus holiday villas in Ayia

Cyprus holiday villas in Ayia Napa and Protaras are ready for you to spend a truly great holiday! Cyprus holiday villas

best

Glad to be one of the visitors on this awe inspiring web site : D.
growtopiahack.onlinecheats4u.com

These you will then see the

These you will then see the most important thing, the application provides you a website a powerful important internet page: www.onlinecheats4u.com

it's really nice and meanful.

it's really nice and meanful. it's really cool blog. Linking is very useful thing.you have really helped lots of people who visit blog and provide them usefull information. Merihaal Sciatica Vanish Magic

Awesome

Your blog has the same post as another author but i like your better.~:;”*
starwarsgalaxyofheroeshack.onlinecheats4u.com

I like this blog so much,

I like this blog so much, saved to my bookmarks .
spotifypremiumcodes.iwantthis4free.com

I encourage you to read this

It is fine, nonetheless evaluate the information and facts around this correct.
Get close to nature

Tech Expert aware of global warming. A nature lover. Always stay close to nature.

 

WHAT is alone proper for the

WHAT is alone proper for the present: namely, the collection of material, the comprehensive survey and classification of an immense domain of delicate sentiments rolex sea dweller of worth, and distinctions of worth, which live, grow, propagate, and perish—and perhaps attempts to give a clear idea of the recurring and more common forms of these living crystallizations—as preparation for a THEORY OF TYPES of morality. To be sure, people have not hitherto been so modest.

All the philosophers, with a pedantic and ridiculous seriousness, demanded of themselves something very tag Heuer Link much higher, more pretentious, and ceremonious, when they concerned themselves with morality as a science: they wanted to GIVE A BASIC to morality—and every philosopher hitherto has believed that he has given it a basis; morality itself, however, has been regarded as something "given." How far from their awkward pride was the seemingly insignificant submariner Rolex problem—left in dust and decay—of a description of forms of morality, notwithstanding that the finest hands and senses could hardly be fine enough for it!

It was precisely owing to moral philosophers' knowing the moral facts imperfectly, in an arbitrary epitome, or an accidental abridgement—perhaps as the morality of their environment, their position, their church, their Zeitgeist, their climate and zone—it was precisely because they were badly instructed with regard to nations, eras, and past ages, and were by no means eager to know about these matters, that they did not even come in sight of the real problems of morals—problems which only disclose themselves by a comparison of MANY kinds of morality. In every "Science of Morals" hitherto, strange as it designer devi kroell replica handbags may sound, the problem of morality itself has been OMITTED: there has been no suspicion that there was anything problematic there! That which philosophers called "giving a basis to morality," and endeavoured to realize.

When seen in a right light, proved merely a learned form of good FAITH in prevailing morality, a new means of its EXPRESSION, consequently just a matter-of-fact within the sphere of a definite morality, yea, in its ultimate motive, a sort of rolex daytona denial that it is LAWFUL for this morality to be called in question—and in any case the reverse of the testing, analyzing, doubting, and vivisecting of this very faith. Hear, for instance, with what innocence—almost worthy of honour—Schopenhauer represents his own task 361.

It is fine, nonetheless

It is fine, nonetheless evaluate the information and facts around this correct. Rassiff Amazing WoodWork Blaster

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

great

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

reply

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

nice

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

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