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?

 

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

Reply via email to