开发者

log4net: PropertyFilter not working

I have configured this filter for one of my log4net appenders (uses AdoNetAppender):

    <filter type="log4net.Filter.LevelRangeFilter">
      <levelMin value="DEBUG" />
      <acceptOnMatch value="true" />
    </filter>
    <filter type="log4net.Filter.PropertyFilter">
      <key value="c" />
      <stringToMatch value="Stribe.Kernel" />
开发者_运维知识库      <acceptOnMatch value="true" />
    </filter>
    <filter type="log4net.Filter.DenyAllFilter" />

I'm probably doing something really wrong, but been trying to figure it out for an hours now and it's driving me crazy. What i want the filter to do is deny all entries, except those who's logger name begin (or contain, both fine for me) with "Stribe.Kernel"

Also tried something with but i cannot get it to work.

Any suggestions?


How about you attach the appender to the logger "Stribe.Kernel" instead of the root logger like this:

<root>
    <level value="ALL" />
</root>
<logger name="Stribe.Kernel">
    <level value="DEBUG" />
    <appender-ref ref="YourAppender" />
</logger>

If you are using other loggers you can still attach them to the root logger.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜