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 Burton Strauss <Bu...@SmallNetSolutions.com> on 2005/12/02 18:25:00 UTC

PropertyConfigurator, appenders attaching to root and multiple outputs at different levels...

(1.2.12) What I have is this log4j.properties:

log4j.rootLogger=info,console,file

log4j.logger.console=warn
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.SimpleLayout

log4j.logger.file=info
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=my.log
log4j.appender.file.layout=org.apache.log4j.SimpleLayout

Which gives me this:

Logger #0 is root level INFO
        Appender 1 'console' is ConsoleAppender to System.out
        Appender 2 'file' is FileAppender to my.log
Logger #1 is console level WARN
Logger #2 is file level INFO

What I want is this:

Logger #0 is root level INFO
Logger #1 is console level WARN
        Appender 1 'console' is ConsoleAppender to System.out
Logger #2 is file level INFO
        Appender 1 'file' is FileAppender to my.log

So I get all messages in the file, but only warnings+ on the console.

I've been reading this
http://logging.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurat
or.html and I still don't understand why log4j.appender.console attaches to
the root instead of the named appender.

So the ? is a two parter... Why? and What Should I be doing?


Thanks!


-----Burton



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org