Je reçois l'exception suivante lorsque je tente d'appelerCommon.Logging exception config
var log = LogManager.GetLogger(this.GetType());
Une exception de première chance de type 'Common.Logging.ConfigurationException' a eu lieu dans Common.Logging.dll
Une exception unhanded de type 'Common.Logging.ConfigurationException' se sont produits dans Common.Logging.dll
informations complémentaires: configuration Échec pour obtenir Common.Logging de section de configuration « commo n/enregistrement ».
Ceci est une application .NET 4 avec des références à
- log4net.dll
- Common.Logging.dll
- Common.Logging.log4net.dll
ma app.config a comme suit:
<?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>
J'essaie d'appeler comme ceci:
var log = LogManager.GetLogger(this.GetType());
log.Debug(m => m("testing"));
Qu'est-ce que je manque?
Whoa! En effet, supprimez cela et cela fonctionne. des points supplémentaires si vous dites «pourquoi». – Jahmic
Je crois que c'est à cause de la façon dont le schéma de configuration est validé ou chargé. – Klinger
une belle! Cette réponse est toujours valide pour VS2012/.Net 4.5, Common.Logging 2.1.1, Common.Logging.Log4Net 2.0.0 et log4net 1.2.10 –