How to filter by NDC?
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?
I just found the solution. I forgot to filter out the non matching events by adding the following line:
<filter type="log4net.Filter.DenyAllFilter" />
精彩评论