logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mschil...@aol.com
Subject Re: Seemingly simple task
Date Thu, 08 Aug 2002 13:18:11 GMT
In a message dated 8/6/02 8:25:55 PM Pacific Daylight Time, Mschilli1 writes:


> * 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
> 

Hmm, nobody responded to my question yet -- is there anybody out there who 
has suggestions on how to resolve this seemingly simple problem? I'd really 
apprechiate any help.

-- Mike

Mike Schilli
log4perl@perlmeister.com
http://perlmeister.com
http://log4perl.sourceforge.net

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