logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Info Only Appender
Date Tue, 14 Jun 2005 18:12:37 GMT
If you want to allow only INFO events then you would use

<filter type="log4net.Filter.LevelMatchFilter">
  <levelToMatch value="INFO" />
<filter type="log4net.Filter.DenyAllFilter">

if you want to opposite effect, i.e. all events except INFO, they you
can use:

<filter type="log4net.Filter.LevelMatchFilter">
  <levelToMatch value="INFO" />
  <acceptOnMatch value="false" />

Here the filter will Deny the INFO events and pass on the other events,
and without the DenyAllFilter these will be logged.

Essentially you have a chain of filters and you need to decide if you
want the filters to explicitly accept events or explicitly deny events,
then decide what to do with the remaining events - either accept them
all (the default) or deny them all (with the DenyAllFilter).


> -----Original Message-----
> From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
> Sent: 14 June 2005 19:07
> To: Log4NET User
> Subject: Re: Info Only Appender
> After reading the SDK docs for FilterSkeleton and 
> LevelMatchFilter, I didn't think I needed to put the 
> DenyAllFilter at the end of the filter chain. The website 
> gave a clearer explaination of what its necessary.
> It seems like a good recemendation would be to always include 
> a DenyAllFilter at the end of the filter chain. Is that 
> generally the case Nicko?
> --- Ron Grabowski <rongrabowski@yahoo.com> wrote:
> > 1)
> > 
> >  <appender name="SystemLog" type="log4net.Appender.FileAppender">
> >  <filter type="log4net.Filter.LevelMatchFilter">
> >   <levelToMatch value="INFO" />
> >  </filter>
> >  ...
> >  </appender>

View raw message