I'm getting the following exception when I try to call
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.ConfigurationException' occurred in Common.Logging.dll
Additional information: Failed obtaining configuration for Common.Logging from configuration section 'common/logging'.
This is a .NET 4 application with references to
my app.config has the following:
<?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>
I'm trying to call like so:
var log = LogManager.GetLogger(this.GetType());
log.Debug(m => m("testing"));
What am I missing?
It runs ok if you remove element startup
from your config.
EDIT: Instead of removing, just move the startup element after configsections.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With