tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashish Sarna" <ashish.sa...@thePSI.com>
Subject RE: Deleting web application specific log files
Date Fri, 06 Feb 2009 04:47:01 GMT
 

 

-----Original Message-----
From: Ashish Sarna [mailto:ashish.sarna@thePSI.com] 
Sent: Tuesday, February 03, 2009 6:19 PM
To: users@tomcat.apache.org
Subject: Deleting web application specific log files

 

Hello

 

 

 

I am using tomcat6 to deploy my web applications. For logging the messages

which come through 

 

 

 

httpServletRequest.getSession().getServletContext().log("Some message");

calls.

 

 

 

I have created a logging.properties file, which contains this:

 

 

 

handlers = org.apache.juli.FileHandler

 

 

 

############################################################

 

# Handler specific properties.

 

# Describes specific configuration info for Handlers.

 

############################################################

 

 

 

org.apache.juli.FileHandler.level = FINE

 

org.apache.juli.FileHandler.directory = ${catalina.base}/logs/myapp

 

org.apache.juli.FileHandler.prefix = myapp_log.

 

org.apache.juli.FileHandler.suffix = .txt

 

 

 

and have placed this file in tomcat\webapps\myapp\WEB-INF\classes directory.

 

 

 

This works perfectly to rotate the log files nightly. But I want to delete

the log files after some time (say, set a property so that log files older

than 5 days are deleted). Is there some way of doing this?

 

 

 

java.util.logging.FileHandler has two properties to specify the maximum log

file count and maximum file size :

 

 

 

java.util.logging.FileHandler.limit=102400

 

java.util.logging.FileHandler.count=5 

 

 

 

but, when I try to use java.util.logging.FileHandler in place of

org.apache.juli.FileHandler, no messages get logged through

getServletContext().log("Some message"); calls. It seems that tomcat does

not support java.util.logging. Is there a workaround for this?

 

>> Well, I was wrong here. The java.util.logging provides the solution and
it is supported by tomcat. This resolves my problem.

 

 

I know I can use Log4J for logging my web application's logs, but that would

require a lot of changes in the existing web application (I would have to

replace all getServletContext().log() calls from log4J specific statements).

 

 

 

Any help would be greatly appreciated. Thanks.

 

 

 

Regards

 

Ashish

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message