views:

84

answers:

2

Is there a way to run log4j appender at a specified time?

log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/catalina.out
log4j.appender.R.DatePattern='.'yyyy-MM-dd
log4j.appender.R.layout=org.apache.log4j.PatternLayout

I have put the log4j.properties under /opt/tomcat0/common/classes

A: 

If I understand correctly you want to enable / disable logging at runtime ?

If the above assumption is right - you can do the same via JMX.

Script Runner
Basically if i set log4j.appender.R.DatePattern='.'yyyy-MM-dd inlog4j.properties It rolls over at midnight. is there a way to rollover at say 12:00 NoonPlease suggest/guideThanks,Kaushal
Kaushal
A: 

More information on how to set DailyRollingFileAppender can be found here.

Lalith
I have already referred to http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html
Kaushal