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 Giacomo Fiorentini <g....@esalab.it> on 2006/07/10 16:49:39 UTC

Filter chaining

------------------------------------------------------------------------------------------------
....      
<appender name="appenderName" type="log4net.Appender.FileAppender">
            <param name="File" value="log-data\\my.log" />
            <param name="AppendToFile" value="true" />
            <layout type="log4net.Layout.PatternLayout">
                <param name="ConversionPattern" value="%d [%t] %-5p %c 
[%x] - %m%n" />
            </layout>
            <filter type="log4net.Filter.StringMatchFilter">
                <stringToMatch value="Global" />
            </filter>
            <filter type="log4net.Filter.LevelMatchFilter">
                <levelToMatch value="ERROR" />
            </filter>
            <filter type="log4net.Filter.DenyAllFilter" />
        </appender>
...
------------------------------------------------------------------------------------------------
I'm using release 1.2.10 with compilan target .net 1.1,  and I found a 
strange behaviour with the previous filter chain, but maybe my 
interpretation was wrong...  : in previous config-snippet I configured 
an appender (a FileAppender) that will log messages or events into a 
file, IFF the message contains the string "Global"  AND  the log-level 
is "ERROR"  (i.e. :   only calls to  log.Error  or log.ErrorFormat will 
be logged.   Is it right?

In my example, I see that the second filter does not filter .... :-(   
The behaviour is exactly as it is not present in the config snippet.

Any help ?