My boss gave me a task, creating something like log-on-demand feature in our apps.
- Be able to define a global threshold for all classes to log.
- Be able to add some exception classes with threshold override the predefined global one.
As usually, I google, tried, iisreset, re-try… filter, chained, …
It turns out this is a STANDARD out-of-box feature from log4net, and I actually have been used this since day 1, to control the NHibernate logger threshold in our app.
<root> <level value="INFO" /> <appender-ref ref="AdoNetAppender" /> </root> <logger name="NHibernate"> <level value="ERROR"/> </logger> <logger name="OneProblemClass"> <level value="DEBUG"/> </logger>
See logger section from official log4net configuration doc.