logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mschil...@aol.com
Subject Seemingly simple task
Date Tue, 06 Aug 2002 23:25:55 GMT
Hi all,

looks like I'm having a hard time pulling off this seemingly simple task:

* Log all ERROR (and higher prioritized) messages in the entire system to the 
screen
* Log all DEBUG messages in category A.B.C to a file

I thought it might go something like this:

    log4j.category=Error, Screen
    log4j.category.A.B.C=Debug, Log

    log4j.appender.Screen=ScreenAppender
    log4j.appender.Screen.layout=log4j.SimpleLayout
   
    log4j.appender.Log=FileAppender
    log4j.appender.Log.File=test.log
    log4j.appender.Log.layout=log4j.SimpleLayout

but the problem here is that the DEBUG rule within A.B.C not only triggers 
the A.B.C apender, but also root appender logging to the screen, right? So 
you would get 
debug messages to the screen, which is what I don't want.

Setting the additivity flag of the log file appender to false
would help (like log4j.appender.Log.additivity=false, right?), but error 
messages within A.B.C would no longer be printed to the screen.

When triggering appenders higher up the hierarchy, shouldn't log4j consider 
the correponding logger's priority and -- in this case -- not call the root 
appender for DEBUG messages? Please let me know if I'm overlooking something.

-- Mike
log4perl@perlmeister.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message