开发者

NLog : Why is a config variable mandatory?

I find this puzzling and counter-intuitive :

Why this works :

LoggingConfiguration config = LogManager.Configuration;
config.LoggingRules.Add(rule);
LogManager.Configuration = config;

While this won't (EDIT : log files are 开发者_运维问答not written to target file):

LogManager.Configuration.LoggingRules.Add(rule);

It's funny to see how ready-to-use code snippets spread, while thorough explanations are so scarce


I haven't checked the code but I guess that the property setter has some logic in it.

imho it should had been a method instead, or the configuration shouldn't have been exposed at all.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜