You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Chris <sh...@yahoo.com> on 2010/09/18 21:30:25 UTC
Configuring a system-wide logger factory
How can I configure a system-wide logger factory?
I need to subclass Logger and have my subclass be used everywhere. When
I try to configure it using these options:
log4j.loggerFactory=org.foo.MyLoggerFactory
log4j.rootCategory=INFO, A
log4j.appender.A=org.foo.MyAppender
I get:
Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:399)
at
org.apache.log4j.PropertyConfigurator.registryPut(PropertyConfigurator.java:903)
at
org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:813)
On the other hand, if I replace the rootCategory line with:
log4j.logger.test=INFO, A
and then I call Logger.getLogger("test"), everything works fine.
Configuring the loggerFactory using log4j.xml also fails, but silently.
It just uses the default LoggerFactory instead of mine.
What do I need to do to get log4j to use my LoggerFactory everywhere,
not just for specific named loggers?
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org