Is there any way to filter out INFO from the log and only show DEBUG & ERROR, using the config in web.config ?
<root>
<level value="DEBUG" />
<appender-ref ref="ColoredConsoleAppender" />
<appender-ref ref="RollingFileSystemAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
How do I completely disable all logging at runtime? Setting the Threshold on the Hierarchy to Level OFF will disable all logging from that Hierarchy. This can be done in the log4net configuration file by setting the "threshold" attribute on the log4net configuration element to "OFF".
For log4net to know where to store your log messages, you add one or more appenders to your configuration. An appender is a C# class that can transform a log message, including its properties, and persist it somewhere. Examples of appenders are the console, a file, a database, an API call, elmah.io, etc.
Log4net is a logging utility for . NET applications. It's based on log4j, which is for Java applications. Log4net is highly configurable, so you can use it in many scenarios.
In log4X there are filters that can be applied to appenders in order to filter messages; here is a list of the filters
In your case you would need to filter your three appenders in order to exclude the INFO
level: a LevelMatchFilter refusing INFO
level logs would work:
<filter type="log4net.Filter.LevelMatchFilter">
<acceptOnMatch value="false" />
<levelToMatch value="INFO" />
</filter>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With