Say I set my log4net logger’s minLevel and maxLevel to FATAL and DEBUG respectively, but under some scenario I want to mute the log-items written in the WARN level, and keep all the other levels in the range active.
Is it possible to somehow use ‘discrete’ levels of log-levels rather than specifying a range using minLevel and maxLevel?
I assume this should be simple, but I haven’t found any log4net docs or examples dealing with this issue.
You can use the
LevelMatchFilteron your appender.Example:
This example will only print DEBUG; INFO and ERROR messages. It is easy to customize this according to your needs.
Note: Do not forget the
DenyAllFilterat the end.