I want to upgrade to Nlog version 2.1. Which version of Common Logging library should I use?
I am currently using Common Logging version 2.0 with Nlog 2.0. I replaced NLog v2.0 with 2.1 but it does not work. Any help?
I get this error - Failed obtaining configuration for Common.Logging from configuration section 'common/logging'.
You should use Common.Logging.NLog20 but you'll have to add an assembly redirect :
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
</assemblyBinding>
And your common logging config should look something like this :
<common>
<logging>
<factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
<arg key="configType" value="FILE" />
<arg key="configFile" value="~/NLog.config" />
</factoryAdapter>
</logging>
</common>
Thankfully the nuget packages for common.logging and adapters has changed (see here) You should be able to use the Common.Logging.NLog21 libarary.
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