You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Chris Jansen <ch...@gmail.com> on 2011/05/04 00:29:10 UTC

Custom string match filter stopped working

I created a custom string match filter to *not* log lines that match a
specified string, rather than log filter matches like StringMatchFilter. I
also added logic to search the exception if it exists. The logic is all in
the Decide method (see code below).

We have a production environment where we're using log4net with Web
services. The filter has been working fine for a few weeks until a couple of
days ago. Now, for some reason, one of the filters is no longer working. It
could be that none of them are working anymore, but we're consistently
seeing log messages from one of the filters.

Any idea what might cause this? The custom filter Decide method can be
viewed here: http://pastebin.com/1PZhyDJd

Thanks.

Re: Custom string match filter stopped working

Posted by Chris Jansen <ch...@gmail.com>.
Good question, it depends on the configuration. Since _acceptOnMatch is
false from the configuration, that's the way I want it:

  <filter type="log4net.Filter.StringMatchExceptionFilter">
      <stringToMatch value="is currently logged in" />
      <acceptOnMatch value="false" />
  </filter>


On Tue, May 3, 2011 at 10:06 PM, Lee Chun Kit <ch...@gmail.com> wrote:

> Should it be that
> FilterDecision.Accept : FilterDecision.Deny
> at lines 35, 47 be reversed into
> FilterDecision.Deny : FilterDecision.Accept
> ?
>
> Regards,
> Chun Kit
>
> p.s. IMHO, the pastebin should be set not to expire so that others who
> read this mailing list in the future can benefit.
>
> On Wed, May 4, 2011 at 6:29 AM, Chris Jansen <ch...@gmail.com> wrote:
> > I created a custom string match filter to *not* log lines that match a
> > specified string, rather than log filter matches like StringMatchFilter.
> I
> > also added logic to search the exception if it exists. The logic is all
> in
> > the Decide method (see code below).
> >
> > We have a production environment where we're using log4net with Web
> > services. The filter has been working fine for a few weeks until a couple
> of
> > days ago. Now, for some reason, one of the filters is no longer working.
> It
> > could be that none of them are working anymore, but we're consistently
> > seeing log messages from one of the filters.
> >
> > Any idea what might cause this? The custom filter Decide method can be
> > viewed here: http://pastebin.com/1PZhyDJd
> >
> > Thanks.
> >
>

Re: Custom string match filter stopped working

Posted by Lee Chun Kit <ch...@gmail.com>.
Should it be that
FilterDecision.Accept : FilterDecision.Deny
at lines 35, 47 be reversed into
FilterDecision.Deny : FilterDecision.Accept
?

Regards,
Chun Kit

p.s. IMHO, the pastebin should be set not to expire so that others who
read this mailing list in the future can benefit.

On Wed, May 4, 2011 at 6:29 AM, Chris Jansen <ch...@gmail.com> wrote:
> I created a custom string match filter to *not* log lines that match a
> specified string, rather than log filter matches like StringMatchFilter. I
> also added logic to search the exception if it exists. The logic is all in
> the Decide method (see code below).
>
> We have a production environment where we're using log4net with Web
> services. The filter has been working fine for a few weeks until a couple of
> days ago. Now, for some reason, one of the filters is no longer working. It
> could be that none of them are working anymore, but we're consistently
> seeing log messages from one of the filters.
>
> Any idea what might cause this? The custom filter Decide method can be
> viewed here: http://pastebin.com/1PZhyDJd
>
> Thanks.
>