开发者

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" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜