tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trond Hersløv <trond.hers...@gotogate.no>
Subject RE: Log rotation HOWTO
Date Tue, 29 Jun 2004 21:22:38 GMT
Hi, maybe you would try the following:
Create a bash-script (or on windows a .bat, with modifications)

create a file called e.g. /path/to/script/rotate_log
#!/bin/sh
file_to_zip=`date +'%m%d'
cp /your_path_to/catalina.out /your_rot_dir/$file_to_zip
echo -n "" > catalina.out
cd /your_rot_dir
gzip $file_to_zip
cd /your_path_to

$ crontab -e (as a user with reading permission for catalina.log and add the
following line to rotate the log 1 am every day)
0 1 * * * /path/to/script/rotate_log >> /path/to/script/rotate_log 2>&1

If you are very unlucky, you might loose log entrys between the cp statement
and the echo statement.
At least this doesn't change the i-node of the catalina.out file, hence the
logging should continue.

I have not tried this myself, and there is NO WARRENTY that it is working.
I SUGGEST you await some comments from other users here before you trie it
out.
Be aware of possible misspellings of file names. It is ment to give you an
idea of how to rotate the logs.

\trond



-----Opprinnelig melding-----
Fra: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
Sendt: Tuesday, June 29, 2004 21:09
Til: Tomcat Users List
Emne: [GFI-SPAM-BA] - RE: Log rotation HOWTO - Bayesian Filter detected
spam


Hi,
Or rather, you can't rotate catalina.out using functionality built into
tomcat.  You can use an external tool such as Apache's logrotate (no space
in the name, google for it).  And as the original poster mentioned this has
been discussed numerous times ;)
 
Yoav

	-----Original Message----- 
	From: Dale, Matt [mailto:Matt.Dale@beCogent.com] 
	Sent: Tue 6/29/2004 3:05 PM 
	To: Tomcat Users List 
	Cc: 
	Subject: RE: Log rotation HOWTO
	
	


	You can't rotate catalina.out. You shouldnt have much in there
anyway if your webapps are coded correctly. If you have an webapp that
outputs a lot to it you can add a customer logger to the context and it is
rotated automatically every day.
	
	Ta
	Matt
	
	-----Original Message-----
	From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br]
	Sent: 29 June 2004 18:30
	To: Tomcat Users List
	Subject: Re: Log rotation HOWTO
	
	
	I didn't find how to make the catalina.log file split each day.
	
	
	<!-- Logger shared by all Contexts related to this virtual host.  By
	default (when using FileLogger), log files are created in the "logs"
	directory relative to $CATALINA_HOME.  If you wish, you can specify
	a different directory with the "directory" attribute.  Specify
either a
	relative (to $CATALINA_HOME) or absolute path to the desired
	directory.-->
	
	
	<Logger className="org.apache.catalina.logger.FileLogger"
	    directory="logs"  prefix="localhost_log." suffix=".txt"
	    timestamp="true"/>
	
	what should I change in the following tag to get it done...?
	
	thanks
	Emerson
	
	
	I©q´me Duval wrote:
	> Search the mailing list! This question was asked recently...
	>
	> These messages might be useful...
	>
	> -----Original Message-----
	> From: Frank Zammetti [mailto:fzammett@hotmail.com]
	> Sent: Tuesday, June 29, 2004 10:04 AM
	> To: tomcat-user@jakarta.apache.org
	> Subject: Log rotation HOWTO
	>
	> I haven't been able to find a clear answer to this anywhere
online,
	> hopefully you fine folks can help...
	>
	> I need a way to rotate my stdout log in Tomcat 5.0.18.  It could
be dalily
	> or weekly (monthly might be OK too).
	>
	> Is thre any way to do this?  I assume so, so how?  Thanks in
advance all!
	>
	> _________________________________________________________________
	> Get fast, reliable Internet access with MSN 9 Dial-upဓ now 3
months FREE!
	> http://join.msn.click-url.com/go/onm00200361ave/direct/01/
	>
	>
	>
---------------------------------------------------------------------
	> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
	> For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org
	>
	>
	>
	>
------------------------------------------------------------------------
	>
	> Subject:
	> AW: Managing Tomcat logs
	> From:
	> Gunnar Oörschke <gpoerschke@canto.de>
	> Date:
	> Tue, 22 Jun 2004 09:24:09 -0400
	> To:
	> "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
	>
	> To:
	> "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
	>
	>
	> Could you please use tomcats web admin to change logging
settings...
	>
	> By default you can access http://localhost:8080/admin
	>
	> You can activate a separate log for several contents.
	>
	>
	> -----Urspr¼ngliche Nachricht-----
	> Von: Veera Sivakumar [mailto:vsivakumar@rm.com]
	> Gesendet: Dienstag, 22. Juni 2004 11:47
	> An: Tomcat Users List
	> Betreff: Managing Tomcat logs
	>
	> Hi,
	> I am using Tomcat as web server for my application. I start Tomcat
using
	> windows service. All the logs generated by the Application are
written in to
	> a file called stdout.log which is under tomca/logs folder.
	> I have noticed that with continuous use of application,stdout file
size
	> increasing to a large extent. To delete the it I have to stop the
tomcat.
	> Is there any way that I can manage the logs date wise
automatically(without
	> manual intervention). I am not using any third party tool for
logging.
	> The logging mechanism I use is very simple.
	>
	> We have class Debug.java that have a method log(String); This
log() method
	> use System.out.println(); In the application, I use
Debug.log("Exception");
	>
	> I will be more happy if there is any way to manage logs.
	> I have also noticed the following logs generated by Tomcat:
	> 1.localhost_log.2004-06-18.txt
	> 2.localhost_access_log.2004_06_22.txt
	>
	> How to maintain these logs?. Can we off them permanently?
	> Thanks in advance.
	>
	> Regards
	> S.V.Sivakumar
	> QCA Project
	> Tata Infotech Limited
	> Tel:  +44 1235 823411
	> vsivakumar@rm.com / veera.surathu@tatainfotech.com
	>
	> Visit our website at http://www.rm.com
	>
	> This message is confidential.  You should not copy it or disclose
its
	> contents to anyone.  You may use and apply the information only
for the
	> intended purpose.  Internet communications are not secure and
therefore RM
	> does not accept legal responsibility for the contents of this
message.  Any
	> views or opinions presented are only those of the author and not
those of
	> RM.  If this email has come to you in error please delete it and
any
	> attachments.  Please note that RM may intercept incoming and
outgoing e-mail
	> communications.
	>
	> This email has been scanned for viruses by Trend ScanMail.
	>
	>
	>
	>
---------------------------------------------------------------------
	> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
	> For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org
	>
	>
	>
	>
------------------------------------------------------------------------
	>
	> Subject:
	> RE: Managing Tomcat logs
	> From:
	> "Robert Harper" <robert@iat-cti.com>
	> Date:
	> Tue, 22 Jun 2004 10:20:15 -0400
	> To:
	> "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
	>
	> To:
	> "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
	>
	>
	> Instead of using System.out.println() to log your messages, use
the
	> HttpServlet's log() method. You can specify the logging class you
want to
	> use,
	> the path it writes to, the base name, and extension. Each day a
new file is
	> created and you can simply delete the old ones as they are closed
when a new
	> file is started each day. You could also create your own logger
that manages
	> the
	> file size in some way. I have used the former and have specified
the file
	> name
	> and path so that it easy form me to manage. My logs are separate
from the
	> normal
	> logs as well.
	>
	> Robert S. Harper
	> 801.265.8800 ex. 255
	>
	>
	>>-----Original Message-----
	>>From: Veera Sivakumar [mailto:vsivakumar@rm.com]
	>>Sent: Tuesday, June 22, 2004 3:47 AM
	>>To: Tomcat Users List
	>>Subject: Managing Tomcat logs
	>>
	>>Hi,
	>>I am using Tomcat as web server for my application. I start Tomcat
using
	>>windows service. All the logs generated by the Application are
written in
	>
	> to a
	>
	>>file called stdout.log which is under tomca/logs folder.
	>>I have noticed that with continuous use of application,stdout file
size
	>>increasing to a large extent. To delete the it I have to stop the
tomcat.
	>>Is there any way that I can manage the logs date wise
	>
	> automatically(without
	>
	>>manual intervention). I am not using any third party tool for
logging.
	>>The logging mechanism I use is very simple.
	>>
	>>We have class Debug.java that have a method log(String);
	>>This log() method use System.out.println();
	>>In the application, I use Debug.log("Exception");
	>>
	>>I will be more happy if there is any way to manage logs.
	>>I have also noticed the following logs generated by Tomcat:
	>>1.localhost_log.2004-06-18.txt
	>>2.localhost_access_log.2004_06_22.txt
	>>
	>>How to maintain these logs?. Can we off them permanently?
	>>Thanks in advance.
	>>
	>>Regards
	>>S.V.Sivakumar
	>>QCA Project
	>>Tata Infotech Limited
	>>Tel:  +44 1235 823411
	>>vsivakumar@rm.com / veera.surathu@tatainfotech.com
	>>
	>>Visit our website at http://www.rm.com
	>>
	>>This message is confidential.  You should not copy it
	>>or disclose its contents to anyone.  You may use and apply the
information
	>>only for the intended purpose.  Internet communications are not
secure and
	>>therefore RM does not accept legal responsibility for the contents
of this
	>>message.  Any views or opinions presented are only those of the
author and
	>>not those of RM.  If this email has come to you in error please
delete it
	>>and any attachments.  Please note that RM may intercept incoming
and
	>>outgoing e-mail communications.
	>>
	>>This email has been scanned for viruses by Trend ScanMail.
	>
	>
	>
	>
	>
---------------------------------------------------------------------
	> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
	> For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org
	>
	>
	>
	>
------------------------------------------------------------------------
	>
	> Subject:
	> RE: Managing Tomcat logs
	> From:
	> "Dale, Matt" <Matt.Dale@beCogent.com>
	> Date:
	> Tue, 22 Jun 2004 09:12:16 -0400
	> To:
	> "Tomcat Users List" <tomcat-user@jakarta.apache.org>
	>
	> To:
	> "Tomcat Users List" <tomcat-user@jakarta.apache.org>
	>
	>
	> You could add a customer Logger tag to the context in your
server.xml and
	> add the swallowOutput="true" attribute, this will put standard out
and
	> standard error into the log file that you specify which is rotated
on a
	> daily basis automatically for you by tomcat.
	>
	> Ta
	> Matt
	>
	> -----Original Message-----
	> From: Veera Sivakumar [mailto:vsivakumar@rm.com]
	> Sent: 22 June 2004 10:47
	> To: Tomcat Users List
	> Subject: Managing Tomcat logs
	>
	>
	> Hi,
	> I am using Tomcat as web server for my application. I start Tomcat
using
	> windows service. All the logs generated by the Application are
written in to
	> a file called stdout.log which is under tomca/logs folder.
	> I have noticed that with continuous use of application,stdout file
size
	> increasing to a large extent. To delete the it I have to stop the
tomcat.
	> Is there any way that I can manage the logs date wise
automatically(without
	> manual intervention). I am not using any third party tool for
logging.
	> The logging mechanism I use is very simple.
	>
	> We have class Debug.java that have a method log(String);
	> This log() method use System.out.println();
	> In the application, I use Debug.log("Exception");
	>
	> I will be more happy if there is any way to manage logs.
	> I have also noticed the following logs generated by Tomcat:
	> 1.localhost_log.2004-06-18.txt
	> 2.localhost_access_log.2004_06_22.txt
	>
	> How to maintain these logs?. Can we off them permanently?
	> Thanks in advance.
	>
	> Regards
	> S.V.Sivakumar
	> QCA Project
	> Tata Infotech Limited
	> Tel:  +44 1235 823411
	> vsivakumar@rm.com / veera.surathu@tatainfotech.com
	>
	> Visit our website at http://www.rm.com
	>
	> This message is confidential.  You should not copy it
	> or disclose its contents to anyone.  You may use and apply the
information
	> only for the intended purpose.  Internet communications are not
secure and
	> therefore RM does not accept legal responsibility for the contents
of this
	> message.  Any views or opinions presented are only those of the
author and
	> not those of RM.  If this email has come to you in error please
delete it
	> and any attachments.  Please note that RM may intercept incoming
and
	> outgoing e-mail communications.
	>
	> This email has been scanned for viruses by Trend ScanMail.
	>
	>
	>
------------------------------------------------------------------------
	>
	> Any opinions expressed in this E-mail may be those of the
individual and not necessarily the company. This E-mail and any files
transmitted with it are confidential and solely for the use of the intended
recipient. If you are not the intended recipient or the person responsible
for delivering to the intended recipient, be advised that you have received
this E-mail in error and that any use or copying is strictly prohibited. If
you have received this E-mail in error please notify the beCogent postmaster
at postmaster@becogent.com
	> Unless expressly stated, opinions in this email are those of the
individual sender and not beCogent Ltd. You must take full responsibility
for virus checking this email and any attachments.
	> Please note that the content of this email or any of its
attachments may contain data that falls within the scope of the Data
Protection Acts and that you must ensure that any handling or processing of
such data by you is fully compliant with the terms and provisions of the
Data Protection Act 1984 and 1998.
	>
	>
	>
	>
	>
------------------------------------------------------------------------
	>
	>
---------------------------------------------------------------------
	> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
	> For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org
	>
	>
	>
------------------------------------------------------------------------
	>
	>
---------------------------------------------------------------------
	> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
	> For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org
	
	
	--
	Emerson Cargnin
	Analista de Sistemas
	Setor de Desenvolvimento de Sistemas - TRE-SC
	tel : (048) - 251-3700 - Ramal 3181
	
	
---------------------------------------------------------------------
	To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
	For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
	
	




This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


**********************************************************************
This email message has been swept by
MIMEsweeper for the presence of computer viruses.
**********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message