Leif,

This is normal behavior, though not necessarily expected.  The
LevelMatchFilter will return Filter.NEUTRAL if no match is made, and this
means it is passed to the next filter.  When there is no filter, the event
gets passed on to the appender, which appends it.  So, you need the
DenyAllFilter in the chain to stop events from getting passed to the
appender.

I will also mention that we have created some new filter classes for the
v1.3 release.  They provide for some interesting configuration options that
makes creating filter chains slightly easier.  You can take a look at them
in the current cvs.  They are in the org.apache.log4j.filters package.  If
you have any comments or questions, let me know.  They are meant to be
"useful" and if they don't do what folks need, I'd rather know now so they
can be fixed.

-Mark

> -----Original Message-----
> From: Leif Hanack [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 20, 2002 8:09 AM
> To: Log4j
> Subject: LevelMatchFilter
> 
> 
> Hello,
> 
> i'm a bit confuse about using filters. 
> Using the LevelMatchFilter without the DenyAllFilter i receive 
> info and debug messages in my appender. After added the DenyAllFilter
> the behaviour was like i expected. Only error Logs are append to my 
> Appender.
> 
> Is the normal? Or a bug? Or did i forgot s.th. importend?
> 
>         <filter class="org.apache.log4j.varia.LevelMatchFilter">
>              <param name="LevelToMatch" value="ERROR"/>
>              <param name="AcceptOnMatch" value="true" />
>         </filter>
>         <filter class="org.apache.log4j.varia.DenyAllFilter"/>
> 
> The LevelRangeFilter works as i except.
> 
>         <filter class="org.apache.log4j.varia.LevelRangeFilter">
>              <param name="LevelMin" value="DEBUG"/>
>              <param name="LevelMax" value="INFO"/>
>         </filter>
> 
> The above will only log debug and info logs to another appender.
> 
> Thanks in advance, Leif
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to