tags:

views:

34

answers:

1

In log4net I want to filter log messages by the value of the NDC like this:

  <filter type="log4net.Filter.PropertyFilter">
    <Key value="NDC" />
    <stringToMatch value="MyContext" />
  </filter>

Somehow the above filter is not working like I expected.

How do I have to configure a filter for my appender that will only match a certain NDC?

A: 

I just found the solution. I forgot to filter out the non matching events by adding the following line:

<filter type="log4net.Filter.DenyAllFilter" />
Martin