Friday, May 18, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: how to configure a "deny stringmatch filter"
Prev Next
You are not authorized to post a reply.

Author Messages
alexander.wolff@gmail.com

07/20/2008 6:55 AM  
the following filter:
 
<filter type="log4net.Filter.StringMatchFilter">
    <stringToMatch value="database" />
</filter>
 
Look for the substring 'database' in the message text of the event, in the case that text is found the filter is ACCEPTED and the message is logged. OK
 
I want to configure a filter that DENY the substring 'database' (don't log the message)
 
how can I configure that?
 
thanks in advance,
Alexander Wolff
Daniel Williams

07/20/2008 3:38 PM  

I believe this will work:

<filter type="log4net.Filter.StringMatchFilter">
    <stringToMatch value="database" />
    <acceptOnMatch="false"/>
</filter>
<filter type="denyAllFilter"/>

If not this exactly, then search for acceptOnMatch and see what the
right settings are.

Cheers,
Daniel Williams

alexander.wolff@gmail.com

07/21/2008 8:27 PM  
I tried but...

To be concrete, which I need is not to record in the log file (Im using FileAppender in this case) messages which contain string "ORA-00001"

Then I tried with the following filter:

        <filter type="log4net.Filter.StringMatchFilter">
            <acceptOnMatch value="false" />
            <stringToMatch value="ORA-00001" />
        </filter>

But..errors messages with "ORA-00001" are logged :(

Peculiarly, with the following filter:

        <filter type="log4net.Filter.StringMatchFilter">
            <acceptOnMatch value="true" />
            <stringToMatch value="ORA-00001" />
        </filter>
        <filter type="log4net.Filter.DenyAllFilter" />

Only messages that contain the string "ORA-00001" are logged (OK, it's the behavior that I would hope)

And with the following filter:

        <filter type="log4net.Filter.StringMatchFilter">
            <acceptOnMatch value="false" />
            <stringToMatch value="ORA-00001" />
        </filter>
        <filter type="log4net.Filter.DenyAllFilter" />

No message is recorded in log (OK, it's the behavior that I would hope)

Some Idea?
You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > how to configure a "deny stringmatch filter"



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement