Unfortunately the way the filters work/are implemented isn't brilliant. In your example the behaviour is to OR the filters specified. i.e. if it contains 'Global' or if the level is 'Error'.
You can get close to the behaviour you want by dropping the LevelMatchFilter and adding a <threshold value="Error" /> to the appender. This will let through Error and above (which is different to your filter). Or you can implement a custom filter in your own assembly that does what you want. Apologies, Nicko > -----Original Message----- > From: Giacomo Fiorentini [mailto:[EMAIL PROTECTED] > Sent: 10 July 2006 15:50 > To: Log4NET User > Subject: 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 ? > >
