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 "Mangano, Jonathan" <Jo...@team.telstra.com> on 2005/11/01 01:22:00 UTC

RE: Filter Based On Logging Class

An easy alternative that will achieve something close to what you are
trying to do is to add the following line to your log4j.properties:

log4j.logger.javax.naming org.jnp.server=FATAL

That way only FATAL errors are logged from the package (or class) which
"should" hopefully be very rare. An in the case there is a log with a
level of FATAL you probably want to know about it anyway.

Regards

Jonathan

-----Original Message-----
From: Jeremy Whitlock [mailto:jcscoobyrs@gmail.com] 
Sent: Tuesday, 1 November 2005 5:01 AM
To: Log4J-User
Subject: Filter Based On Logging Class

Hey all,
I would like to implement a filter that would allow me to restrict
messages based on the class that is sending the LoggingEvent. So I could
have something like:

<filter class="my.filter.Class">
<param name="acceptOnMatch" value="false" /> <param name="expression"
value="javax.naming org.jnp.server" /> </filter>

And the filter would not log any class that created a LoggingEvent if
that class was in either of those packages. Is there one of these
available? If not, how should I go about writing one? I do not see how I
can get the class from the LoggingEvent.

Take care,
Jeremy

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