1

I would like to know if it's possible to override a log4net appender threshold.

Default threshold level for the appender is ERROR, but for some namespaces i would like to log INFO as well, e.g. program start/stop info messages.

For example override the log level like this.

<appender name="Console" type="log4net.Appender.ConsoleAppender">
<threshold value="ERROR"/>
    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%level %thread %logger - %message%newline" />
    </layout>
    <logger name="My.Main.Program">
        <level value="INFO" />
    </logger>
</appender>

Thanks in advance.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
  • No, this won't work. The logger submits the logging event - if it reaches the set level - to the appender, which then uses it's own threshold to decide what to do with it. If you can move the threshold though from the appender to, say, the level on the root logger, then it will be easy to accomplish. – stuartd Oct 02 '15 at 15:22

0 Answers0