Note that the <filter>
tags (as shown in the examples above) must appear within an <appender>
tag! For example (this is not a valid log4net configuration--I'm only showing how the <filter>
tag is a child entry under <appender>
:
<configuration>
<configSections>
<section ...="" />
</configSections>
<startup>
<supportedRuntime ...="" />
</startup>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{dd MMM yyyy HH:mm:ss} {%thread} %level - %message%newline%exception"/>
</layout>
<filter type="log4net.Filter.LevelMatchFilter">
<acceptOnMatch value="true" />
<levelToMatch value="INFO" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
</appender>
<root>
<appender-ref ...="" />
</root>
<logger name="Log4NetTest.OtherClass">
<level value="DEBUG"/>
<appender-ref ref="ConsoleAppender"/>
</logger>
</log4net>
</configuration>