NSLogging through log4j
NSLogging through log4j
- Subject: NSLogging through log4j
- From: Gavin Eadie <email@hidden>
- Date: Sat, 9 Apr 2005 19:29:14 -0400
I'm using NSLog.Log4JLogger to direct NSLog output through log4j, but
I seem to be having a little trouble and wonder if this excellent
list's membership can help.
My log4j properties are:
log4j.rootCategory info, A1
log4j.appender.A1 org.apache.log4j.ConsoleAppender
Next is the code which sets up:
NSLog.setOut(new NSLog.Log4JLogger(logger, NSLog.DebugLevelDetailed));
NSLog.setErr(new NSLog.Log4JLogger(logger, NSLog.DebugLevelDetailed));
NSLog.setDebug(new NSLog.Log4JLogger(logger, NSLog.DebugLevelDetailed));
And then code which tests the logging:
logger.info("========[ log4j logging active ]========");
NSLog.out.appendln("========[ NSLog.out logging active ]========");
NSLog.err.appendln("========[ NSLog.err logging active ]========");
NSLog.debug.appendln("========[ NSLog.debug logging active ]========");
logger.debug("========[ log4j message with priority set to DEBUG");
logger.info("========[ log4j message with priority set to INFO");
logger.warn("========[ log4j message with priority set to WARN");
logger.error("========[ log4j message with priority set to ERROR");
logger.fatal("========[ log4j message with priority set to FATAL");
Finally, the output:
INFO : ========[ log4j logging active ]========
INFO : ========[ log4j message with priority set to INFO
WARN : ========[ log4j message with priority set to WARN
ERROR : ========[ log4j message with priority set to ERROR
FATAL : ========[ log4j message with priority set to FATAL
_______________________
Note that the NSLog.xxx.appendln("... lines are not logged. If I set
the "log4j.rootCategory" to "debug" instead of "info", the
NSLog.xxx.appendln() lines are logged as I would expect. If I don't
divert NSLog.xxx to log4j, the NSLog.xxx.appendln() lines are logged
...
It looks like NSLog.xxx is not emitting logging above the DEBUG
level, so it gets dropped if log4j is set to INFO.
Any suggestions? With thanks for insights, Gavin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden