If the ERROR events are all coming from a small number of sources, you can change the log level of just those loggers to filter out those messages.
From the log4net documentation:

   <!-- Print only messages of level WARN or above in the package Com.Foo -->
   <logger name="Com.Foo">
       <level value="WARN" />
   </logger>


This would cause Com.Foo log events (and possibly Com.Foo.* ???) to not be logged if they are below the WARN level.

Setting AcceptOnMatch to "false" means that the result of the filter is neutral if the string is found, meaning it just continues on through the filter chain, and likely is accepted by default at the end. Unfortunately, there is no DenyOnMatch configuration, so I don't see any way to use it for your purposes.

~Loren


Parrish, Ken wrote:

I have a server deployed which is generating ‘false positive’ log4net ERROR events. These should be changed to be WARN events so that they can be filtered out by a configuration change. Unfortunately, deploying a patch to the server at this point in time means moving heaven and earth to get the support needed for QA and deployment.

What I would like to do is to devise a change to the log4net configuration which allows filtering OUT of the specific events that are ‘false positive’. Generally, it seems that the <filter> option on an appender indicates what IS to be included, not what should be excluded.

How can I design an appender with a string filter that excludes all events that contain a particular string, but allows all other events to fall through and be reported. In the following example, I wish to filter OUT all events that contain the string ="Zero Length Request Received" and leave everything else.

In the SDK, there is an option named: AcceptOnMatch. Can that be incorporated into this type of filter to get the desired effect?

Thanks,

Ken Parrish

Gomez, Inc.

<filter type="log4net.Filter.StringMatchFilter">

<!-- ??? will this work ??? -->

<stringToMatch value="Zero Length Request Received" AcceptOnMatch=”false” />

</filter>

------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.35/2124 - Release Date: 05/20/09 06:22:00


Reply via email to