Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log4net - how to find out appender and it's properties at runtime?

Tags:

When debugging logging configuration, how do I see what appenders the logger is using and view specific appender's properties? I'm having trouble finding this info by looking at ILog logger in watch window.

enter image description here

like image 879
dev.e.loper Avatar asked Jan 31 '12 15:01

dev.e.loper


People also ask

How do I completely disable all logging at runtime?

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".

Where is log4net configuration file?

You can configure the log4net. config file to create log files. The file is located in the webroot\App_data directory of the installation.

Is log4net dependent on log4j?

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.


1 Answers

Perhaps this listing will give you what you need.

LogManager.GetRepository().GetAppenders();

Else, this may be of use to you also.

LogManager.GetLogger(yourLogger.GetType()).Logger.Repository.GetAppenders();
like image 89
Adam S Avatar answered Sep 21 '22 00:09

Adam S