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-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to