Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is it possible to direct log output to different appenders by level?

0
10 Posted

Is it possible to direct log output to different appenders by level?

0

Yes it is. Setting the Threshold option of any appender extending AppenderSkeleton, (most log4net appenders extend AppenderSkeleton) will filter out all log events with a lower level than the value of the threshold option. For example, setting the threshold of an appender to DEBUG will also allow INFO, WARN, ERROR and FATAL messages to log along with DEBUG messages. (DEBUG is the lowest level). This is usually acceptable as there is little use for DEBUG messages without the surrounding INFO, WARN, ERROR and FATAL messages. Similarly, setting the threshold of an appender to ERROR will filter out DEBUG, INFO and WARN messages but not ERROR or FATAL messages. This policy usually best encapsulates what the user actually wants to do, as opposed to her mind-projected solution. If you must filter events by exact level match, then you can attach a LevelMatchFilter to any appender to filter out logging events by exact level match.

0

Yes it is. Setting the Threshold option of any appender extending AppenderSkeleton, (most log4net appenders extend AppenderSkeleton) will filter out all log events with a lower level than the value of the threshold option. For example, setting the threshold of an appender to DEBUG will also allow INFO, WARN, ERROR and FATAL messages to log along with DEBUG messages. (DEBUG is the lowest level). This is usually acceptable as there is little use for DEBUG messages without the surrounding INFO, WARN, ERROR and FATAL messages. Similarly, setting the threshold of an appender to ERROR will filter out DEBUG, INFO and ERROR messages but not FATAL messages. This policy usually best encapsulates what the user actually wants to do, as opposed to her mind-projected solution.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123