logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lutz Michael <michael.h.l...@siemens.com>
Subject RE: Multiple loggers with different level problem
Date Thu, 14 Aug 2003 15:23:55 GMT

This is not a bug, it's by design.  We ran into the same confusion some time
ago.

Once a log call is "accepted", it is run entirely up the logging hierarchy.

So, suppose logger A is set to OFF.  Suppose A.B.C is set to DEBUG.  At
first glance, one might expect logging calls in A.B.C to *not* be sent to
A's appenders, but this is not the case.  Once accepted, all appenders up
the chain are fair game.  In a sense, the "filtering" of log messages only
occurs at the level of the call (which might be inherited if not explicitly
set at that level), and that determines alone if it goes up the chain or
not.  So, if a DBUG call were made in A.B.C.D, for instance, that would go
all the way up the chain to appenders attached to A, A.B, A.B.C, and
A.B.C.D.

I'm not too sure about the converse - suppose A is set to DEBUG, and A.B.C
is set to OFF.  I'm not sure what would happen to calls in A.B.C - you'd
have to test that.  I suspect they'd go to no appenders at all.

One way to get around this, I think, is to use filters on the appenders.
Not only can logging levels be controlled in the hierarchy, but a "filter"
can be attached to specific appenders.  You'll have to check out the
documentation for this, I don't know how to do this off the top of my head.

Hopefully this makes sense.  It confused us too at first, but once we got
used to the idea it wasn't a problem.  It's just a little different than
what one might originally anticipate.


Mike


-----Original Message-----
From: Geir Antonsen [mailto:geir.antonsen@morecom.no]
Sent: Thursday, August 14, 2003 11:12 AM
To: Log4J Users List
Subject: Multiple loggers with different level problem


I've run into a problem with having different log levels for to (or more)
loggers on the same branch in logger hierarchy.

It seems that even if the parent logger level is set to OFF, it logs all
messages that its child logs.
Example:

  <logger name="implementation" > 
	  <level value="OFF" />
	  <appender-ref ref="Console" />
	  
  </logger>

  <logger
name="implementation.com.metro.telenor.test.MetroLogTestClientOtherClass" > 
	  <level value="ON" />
	  
	  <appender-ref ref="Chainsaw" />
  </logger>


...will log to both Console and Chainsaw.



Is it possible to get around this behaviour? Have I missed a point
somewhere?
Is it a bug?

Regards

Geir Antonsen


 

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

-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to CSOffice@smed.com.  Thank you

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


Mime
View raw message