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 Paul Ingles <pa...@centaur.co.uk> on 2005/01/14 19:05:44 UTC

Problems with filters

Hi,

Thank you for the suggestions about the configuration, I'm now up and
running. I've placed the configuration into a separate log4net file, and
then load this within my type's static constructor using the
DOCConfigurator.ConfigureAndWatch method.

However, I'm now attempting to filter the content displayed through the
ConsoleAppender. Although I want all levels displayed, I only want those
with certain keywords to appear.

My ConsoleAppender appender element looks as follows:

	<appender name="ConsoleAppender"
type="log4net.Appender.ConsoleAppender" >
		<layout type="log4net.Layout.PatternLayout">
			<param name="ConversionPattern" value="%d [%t] %-5p
%c [%x] %X{auth} - %m%n" />
		</layout>
		<filter type="log4net.Filter.StringMatchFilter">
			<stringToMatch value="consort" />
		</filter>
		<filter type="log4net.Filter.DenyAllFilter" />
	</appender>

So that anything with 'consort' will be allowed through, and everything else
dropped.

However, despite the ConfigureAndWatch call definitely being made, it
appears as if the changes aren't picked up.

Again, apologies if I've completely misunderstood something.

Thanks,
Paul