1
请考虑下面的代码:全正在重置NLOG配置
public static void Main(string[] args)
{
// 1. At this point NLog will search for most common configuration locations,
// as described in http://nlog-project.org/wiki/Configuration_file.
var loggerOne = LogManager.GetLogger("LoggerOne");
// 2. We set NLog configuration to null, hoping that the next time the
// configuration is requested the whole process (1) will be repeated.
LogManager.Configuration = null;
// 3. NLog won't actually repeat process (1), and so logging is disabled for
// the following logger since the configuration is still null.
var loggerTwo = LogManager.GetLogger("LoggerTwo");
}
浏览NLOG的源代码,很显然,这与底层LogFactory
设定在true
在启动configLoaded
领域做的,在将null
分配给Configuration
属性(这对我来说最有意义)之后,未被重置为false
。我的问题是我在这个过程中是否错过了某些东西,或者是否确实如此(无需使用反射)来强制NLog从头开始重新配置自身,并重复过程(1)
。