logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bender Heri" <HBen...@Ergonomics.ch>
Subject Re: Log4J System alerts
Date Thu, 30 Nov 2006 09:40:48 GMT
Here a example how to configure filters. Note: Filters are only available if you use xml configuration.

    <appender name="CONSOLE.OUT" class="org.apache.log4j.ConsoleAppender">
        <param name="target" value="System.out"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{HH:mm:ss.SSS} (%6r) %-5p [%-7t] %F:%L
%x - %m%n"/>
        </layout>
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="debug"/>
            <param name="LevelMax" value="info"/>
            <param name="AcceptOnMatch" value="false"/>
        </filter>
        <filter class="ch.ergonomics.pms.common.supervision.TraceDenyFilter"/>
        <filter class="ch.ergonomics.pms.common.supervision.XMLDenyFilter"/>
    </appender>

This appender has three filters attached. The first is a log4j built in filter (LevelRangeFilter),
the thow others are self written filters, derived from org.apache.log4j.spi.Filter which filter
LogEvents based on some values in MDC.
If a LogEvent reaches an appender, it is presented to the attached filters in the order they
are configured. The Filter results in:
- ACCEPT  the LogEvent is accepted, no more further Filters are asked
- DENY    the Log Event is rejected, no more further Filters are asked
- NEUTRAL next filter in chain is asked

within a self written Filter you can implement any logic you want.

Heri

> -----Original Message-----
> From: garima015 [mailto:garima_indiya@rediffmail.com]
> Sent: Wednesday, November 29, 2006 11:39 PM
> To: log4j-user@logging.apache.org
> 
> 
> 
> Can you please give me some more idea on how to create that 
> filter..and how
> this will be called
> 

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


Mime
View raw message