c# – Common.Logging配置异常
发布时间:2020-12-15 03:54:09 所属栏目:百科 来源:网络整理
导读:当我尝试调用时,我收到以下异常 var log = LogManager.GetLogger(this.GetType()); A first chance exception of type ‘Common.Logging.ConfigurationException’ occurred in Common.Logging.dll An unhanded exception of type ‘Common.Logging.Configur
当我尝试调用时,我收到以下异常
var log = LogManager.GetLogger(this.GetType());
这是一个.NET 4应用程序 > log4net.dll 我的app.config具有以下内容: <?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> <configSections> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler,Common.Logging" /> </sectionGroup> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter,Common.Logging"> <arg key="level" value="ALL" /> <arg key="showLogName" value="true" /> <arg key="showDataTime" value="true" /> <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" /> </factoryAdapter> </logging> </common> </configuration> 我试图像这样打电话: var log = LogManager.GetLogger(this.GetType()); log.Debug(m => m("testing")); 我失踪了什么 解决方法
如果您从配置中删除元素启动,则运行正常.
编辑:而不是删除,只需移动启动元素后配置. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |