dcsimg
Does Log4J init loggers lazily or ASAP?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Russ_Weeks
Posted On:   Tuesday, June 3, 2003 04:57 PM

My log4j.properties file looks something like this: log4j.rootCategory=DEBUG, A1 log4j.responder=DEBUG, A2 log4j.responder.appender.A2=org.apache.log4j.FileAppender log4j.responder.appender.A2.file=responder.log log4j.appender.A1=org.apache.log4j.FileAppender log4j.appender.A1.file=sso.log I'm running log4j in Tomcat, and I've set up a log4j init servlet to locate and parse my log4j.properties file. I also want this init servlet to also go through all available File appenders and prefix the file name with the document root of the webapp, but when I call: LogManager.getLoggerRepository().getCurrentLoggers() I get an empty en   More>>


My log4j.properties file looks something like this:


			
log4j.rootCategory=DEBUG, A1
log4j.responder=DEBUG, A2
log4j.responder.appender.A2=org.apache.log4j.FileAppender
log4j.responder.appender.A2.file=responder.log
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.file=sso.log


I'm running log4j in Tomcat, and I've set up a log4j init servlet to locate and parse my log4j.properties file.



I also want this init servlet to also go through all available File appenders and prefix the file name with the document root of the webapp, but when I call:


LogManager.getLoggerRepository().getCurrentLoggers()

I get an empty enumeration. I can call

LogManager.getRootLogger
to configure the root logger, but that doesn't help for my "responder" category. I also don't want to hard-code
Logger.getLogger( "responder" )
or something because there could be many more of these loggers in the future.


Anybody know how to force Log4J to automatically make my "responder" category available as a current logger?



Thanks,


Russ    <<Less
About | Sitemap | Contact