【C#】log4Net ERROR Failed to find configuration section 'log4net' in the applicat
背景:
我的测试项目是控制台的
Main里面写了如下代码:
log4net.Config.XmlConfigurator.Configure();
主项目assembly文件也设置了:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config",Watch = true)]
然后就一直提示需要配置
后来的修改方法:
在Main方法里,明确指出它需要关联的系统config文件路径即可
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(basePath + "/App.config"));

浙公网安备 33010602011771号