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 Ram Peleg <Ra...@ascom.ch> on 2001/09/18 10:36:33 UTC

Attaching a filter

Hi all

Does anybody know how the key=value line in the property
file should look like, in case i'd like to attach a filter to a
certain appender?

Thanx in advance

Rami

RE: Attaching a filter

Posted by Thomas Tuft Muller <tt...@online.no>.
>From the Filter javadoc:

"Note that filtering is only supported by the DOMConfigurator. The
PropertyConfigurator does not support filters."

>From ..\Log4j-1.1.3\src\java\org\apache\log4j\xml\test\test10.xml

<appender name="A1" class="org.apache.log4j.FileAppender">
                <param name="Append" value="false" />
		<param name="File"   value="temp" />
		<layout class="org.apache.log4j.PatternLayout">
 		    <param name="ConversionPattern"
		           value="%-5p %c{2} - %m\n"/>
		</layout>
                <!-- Accept all LoggingEvents containing the string
                "1" in its message field. -->
		<filter class="org.apache.log4j.varia.StringMatchFilter">
                  <param name="StringToMatch" value="1" />
                  <param name="AcceptOnMatch" value="true" />
		</filter>
                <!-- Reject all LoggingEvents containing the string
                "Message" in its message field. -->
		<filter class="org.apache.log4j.varia.StringMatchFilter">
                  <param name="StringToMatch" value="Message" />
                  <param name="AcceptOnMatch" value="false" />
		</filter>

	</appender>

Hope this helps

--

Thomas


PS Please note that all postings should be in plaintext only.



-----Original Message-----
From: Ram Peleg [mailto:Ram.Peleg@ascom.ch]
Sent: 18 September 2001 09:37
To: LOG4J Users Mailing List
Subject: Attaching a filter



Hi all

Does anybody know how the key=value line in the property
file should look like, in case i'd like to attach a filter to a
certain appender?

Thanx in advance

Rami



*************************************************************************
Copyright ERA Technology Ltd. 2001. (www.era.co.uk). All rights reserved. 
Confidential. No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.

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