我尝试打电话时遇到以下异常
var log = LogManager.GetLogger(this.GetType());
Run Code Online (Sandbox Code Playgroud)
Common.Logging.dll中发生了'Common.Logging.ConfigurationException'类型的第一次机会异常
Common.Logging.dll中发生了'Common.Logging.ConfigurationException'类型的无法处理的异常
附加信息:无法从配置部分'common/logging'获取Common.Logging的配置.
这是一个引用的.NET 4应用程序
我的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>
Run Code Online (Sandbox Code Playgroud)
我试着像这样打电话:
var log = LogManager.GetLogger(this.GetType());
log.Debug(m => m("testing"));
Run Code Online (Sandbox Code Playgroud)
我错过了什么?