Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-137

log4net.Filter.LevelMatchFilter does not work anymore

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 1.2.10
    • 1.2.11
    • Other
    • 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>

      Attachments

        Activity

          People

            ron liu ron
            bpeikes Benjamin Peikes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: