Log4net
  1. Log4net
  2. LOG4NET-137

log4net.Filter.LevelMatchFilter does not work anymore

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 1.2.10
    • Fix Version/s: 1.2.11
    • Component/s: Other
    • Labels:
      None

      Description

      The following log4net configuration used to filter only FATAL messages to the event log. In version 1.2.10, this will send all messages to the EventLog. If I remove the LevelMatchFilter and replace it with a LevelRangeFilter which has a minLevel set to FATAL, the filtering occurs properly.

      <log4net>
      <root>
      <level value="Info" />
      <appender-ref ref="All" />
      <appender-ref ref="Error" />
      <appender-ref ref="EventLog" />
      <!-- <appender-ref ref="Console" /-->
      </root>
      <appender name="EventLog" type="log4net.Appender.EventLogAppender" >
      <param name="ApplicationName" value="SQLNotifyApp" />
      <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d

      {yyyyMMdd:HHmmss.fffff}

      [%t] %-5p %c %x - %m%n" />
      </layout>
      <filter type="log4net.Filter.LevelMatchFilter">
      <param name="LevelToMatch" value="FATAL" />
      </filter>
      </appender>
      <appender name="Error" type="log4net.Appender.RollingFileAppender">
      <file value="SQLNotifyApp_Error.log" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <datePattern value="yyyyMMdd" />
      <filter type="log4net.Filter.LevelMatchFilter">
      <param name="LevelToMatch" value="ERROR" />
      </filter>
      <layout type="log4net.Layout.PatternLayout" >
      <param name="conversionPattern" value="%d

      {yyyyMMdd:HHmmss.fffff}

      [%t] %-5p %c %x - %m%n" />
      </layout>
      </appender>

      <appender name="All" type="log4net.Appender.RollingFileAppender">
      <file value="SQLNotifyApp_All.log" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <datePattern value="yyyyMMdd" />
      <layout type="log4net.Layout.PatternLayout" >
      <param name="conversionPattern" value="%d

      {yyyyMMdd:HHmmss.fffff}

      [%t] %-5p %c %x - %m%n" />
      </layout>
      </appender>
      <appender name="Console" type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout" >
      <param name="conversionPattern" value="%d

      {yyyyMMdd:HHmmss.fffff}

      [%t] %-5p %c %x - %m%n" />
      </layout>
      </appender>
      </log4net>

        Activity

          People

          • Assignee:
            Ron Grabowski
            Reporter:
            Benjamin Peikes
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development