• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to roll over catalina.out in tomcat

 
Princy Mathew
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Catalina.out files in my tomcat are growing very large and taking up a lot of room. Would there be a way to restrict the size of them either by size or date maybe two weeks?

Thanks
Princy
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Logging seems to be one of the things that changes quite a bit from release to release in Tomcat.
Which version are you using?
 
Princy Mathew
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im using Tomcat 5.0

Thanks
princy
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you plan on upgrading any time soon, you might want to hold off on doing anything with logging.
The mechanism in 5.0 has been deprecated.

Here is the page explaining this.
http://tomcat.apache.org/tomcat-5.0-doc/config/logger.html


Personally, I went with log4j, configured in my own app.
Once I did this, Tomcat didn't have much to log and the catalina.out stayed small enough that there was no need to manage it on a constant basis.
[ September 12, 2007: Message edited by: Ben Souther ]
 
Princy Mathew
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got an information that if we set the swallowOutput attribute as true for all web application contexts in server.xml , the output will go to the Logger that's defined at the level of each context. Then, by default, the Logger will roll nightly.

SO is there any way to automatically delete(after certain period or after certain size ) these log files that are created every day.

Thanks
princy
 
Princy Mathew
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got an information that if we set the swallowOutput attribute as true for all web application contexts in server.xml , the output will go to the Logger that's defined at the level of each context. Then, by default, the Logger will roll nightly.

SO is there any way to automatically delete(after certain period or after certain size ) these log files that are created every day.

Thanks
princy
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing in Tomcat that deletes log files but it wouldn't be hard to write a shell or batch script that archives (I would never programmatically delete log files) that have last modified dated over n days old.
 
H. Hall
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I recall Tomcat will automatically create a new catalina.out file if it cannot find one e.g. if you deleted it. Why not create a cron to rename the file catalina.out with say a suffix of today's date that runs at your desired interval. You could compress it at the same time.

Cheers
 
Sebastian Leal-Bennett
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - if you're in linux land then you can write a basic shell script and pop it on the cron eg, the one we use to roll the logs and delete old ones is (it leaves 3days of logs for you - still i test, but it looks to work):

1) copy catalina.out to one site and rename it(this will become the archive)
2) clear out catalina.out
3) delete all files over a set age

This script was designed for itterating through a log dir and its sub dirs (hence the use of find) deleting all files over a set age and rolling those that didnt roll themselves.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic