Log4Net configuring log level *

Question

How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold?

This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info?

<logger name="BrokerCollection.Model.XmlDocumentCreationTask">
  <appender-ref ref="SubmissionAppender"/>
  <level value="Info" />
</logger>

Answer

Within the definition of the appender, I believe you can do something like this:

<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
    <filter type="log4net.Filter.LevelRangeFilter">
        <param name="LevelMin" value="INFO"/>
        <param name="LevelMax" value="INFO"/>
    </filter>
    ...
</appender>
< br > via < a class="StackLink" href=" http://stackoverflow.com/questions/6007/" >Log4Net configuring log level< /a>
Share on Google Plus

About Cinema Guy

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment