Using <acceptOnMatch value="false" /> without a DenyAllFilter is the right way to negate a filter.
If you want to match a fixed substring then specify the StringToMatch property. An alternative is to specify the match using a regular expression via the RegexToMatch property. The RegEx syntax is specified in the Microsoft documentation. For example the following filter will match events that start with 'a' and end with 'b' with anything in between. <filter type="log4net.Filter.StringMatchFilter"> <regexToMatch value="^a.*b$" /> </filter> Nicko > -----Original Message----- > From: Cheng [mailto:[EMAIL PROTECTED] > Sent: 30 March 2005 16:36 > To: Eric Means > Cc: Log4NET User > Subject: Re: StringMatchFilter > > I solved the separation by using StringMatchFilter. > > this appender just log info that contains "aaa" > <filter type="log4net.Filter.StringMatchFilter"> > <param name="StringToMatch" > value="aaa" /> > </filter> > <filter type="log4net.Filter.DenyAllFilter" /> > > this appender receives all rest of the log > <filter type="log4net.Filter.StringMatchFilter"> > <param name="AcceptOnMatch" > value="false" /> > <param name="StringToMatch" > value="aaa" /> > </filter> > > Eric suggested to use RegexToMatch, But I couldn't figure out > how to make it work and I couldn't find any examples. Can > anyone give me some RegexToMatch examples? especially how to > make log info separation. > > thanks > > On Tue, 29 Mar 2005 11:02:51 -0600, Eric Means > <[EMAIL PROTECTED]> wrote: > > Use a regex that matches everything *except* the string you > want filtered out. > > > > > > On Tue, 29 Mar 2005 10:25:38 -0600, Cheng <[EMAIL PROTECTED]> wrote: > > > is there an opposite filter of StringMatchFilter? > > > > > > The problem I want to solve is to filter all logging info that > > > contain a special string to a logfile A, and all other > logging info > > > to a separate logfile B. I don't want to all info in A > repeated in B. > > > > > > thanks. > > > > > > > -- > > Eric Means > > [EMAIL PROTECTED] > > http://www.randomtree.org/eric/ > > >
