tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garthfield Carter <tom...@webconexion.net>
Subject Re: log rotation
Date Fri, 21 Jul 2006 19:48:00 GMT
I just knocked up this script for you. Add a cron job to run this at 
midnight:

#!/bin/bash

# Path to catalina logs directory
CATALINA_LOG_DIR=/usr/local/jakarta-tomcat/logs

# Today's data
DATE=`date +%Y-%m-%d`

# Create backup of catalina.out
cat $CATALINA_LOG_DIR/catalina.out > $CATALINA_LOG_DIR/catalina.out.$DATE

# Wipe catalina.out clean
 > $CATALINA_LOG_DIR/catalina.out

David Smith wrote:

> catalina.out is the redirected output of tomcat -- not a product of 
> log4j or commons-logging.  As such you're best bet is to have a cron 
> job stop tomcat, rename the file and then restart it at say 6:00am 
> when the internet hits the lowest ebb of demand.  That method should 
> be safe for all OS's.
> Unix/Linux seem to handle the sudden disappearance of a file well (or 
> at least better than Windows) and simply create a new one.  Just 
> renaming the file without stop/start may be an option for you on *nix 
> systems.
>
> --David
>
> Mirou, Antoine wrote:
>
>> Hello,
>>
>> What is the easiest way to do a log rotation with tomcat ?
>>
>> For example, I'd like to rotate catalina.out on a daily basis and 
>> have up to 5 versions kept. How can I do it ?
>>
>> Antoine Mirou
>>
>>
>>
>> Ce message et toutes les pièces jointes (ci-après le « message ») 
>> sont confidentiels et établis à l'intention exclusive de ses 
>> destinataires. Toute utilisation de ce message non conforme à sa 
>> destination, toute diffusion ou toute publication, totale ou 
>> partielle, est interdite, sauf autorisation expresse. Si vous recevez 
>> ce message par erreur, merci de le détruire sans en conserver de 
>> copie et d'en avertir immédiatement l'expéditeur. Internet ne 
>> permettant pas de garantir l'intégrité de ce message, la Caisse des 
>> Dépôts et Consignations décline toute responsabilité au titre de ce 
>> message s'il a été modifié, altéré, déformé ou falsifié.
>>
>> This email message and any attachments ("the email") are confidential 
>> and intended only for the recipient(s) indicated. If you are not an 
>> intented recipient, please be advised that any use, dissemination, 
>> forwarding or copying of this email whatsoever is prohibited without 
>> Caisse des Depots et Consignations's prior written consent. If you 
>> have received this email in error, please delete it without saving a 
>> copy and notify the sender immediately. Internet emails are not 
>> necessarily secured, and Caisse des Depots et Consignations declines 
>> responsibility for any changes that may have been made to this email 
>> after it was sent.
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>  
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message