Baski
Baski

Reputation: 839

how to change the logging level of logger in the code overriding value set on config

I have a C# Win Form application and in each class i get the logger like this:

private static readonly ILog Log = LogManager.GetLogger("ApplnLogger");

I configured in my app.config to log messages at info level and above.

Now when a issue is reported i would like to set the logger level to debug so that i will have information in log file necessary for debugging the issue.

How do I set the logger level to debug overriding the config level of INFOwithout having to restart my win form application?

Upvotes: 0

Views: 686

Answers (1)

sgmoore
sgmoore

Reputation: 16077

Check out ConfigureAndWatch

Basically, you tell your program to watch the configuration file for changes. So, if you edit this file, Log4net will automatically use the new settings without you having to restart your application.

Upvotes: 1

Related Questions