开发者

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 a开发者_开发技巧bove.

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜