logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Klein, Scott @ TW" <scott.kl...@L-3com.com>
Subject RE: Seemingly simple task
Date Thu, 08 Aug 2002 17:51:29 GMT
+ root logs to console and set level to ERROR
+ ABC logs to file and set level to DEBUG

your A.B.C error and fatals will go to both the file and the console, but
that's how its supposed to work, but debug, info and warn should not go to
the console, since they should be filtered out by the root logger (right?)

if as you say, the latter part is not true, try adding a level filter to the
root logger....

*** I haven't tested this, its purely theoretical ;l

-----Original Message-----
From: Mschilli1@aol.com [mailto:Mschilli1@aol.com]
Sent: Thursday, August 08, 2002 10:18 AM
To: log4j-user@jakarta.apache.org
Subject: Re: Seemingly simple task


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

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message