Could not load type 'Common.Logging.Factory.AbstractCachingLoggerFactoryAdapter'

4.1k Views Asked by At

I just updated my nuget packages for Common.Logging.Log4Net. Since then I keep getting the following error:

Could not load type 'Common.Logging.Factory.AbstractCachingLoggerFactoryAdapter' from assembly 'Common.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e'

Here is a list of each nuget package that is linked to Common.Logging as well as version:

  • Common.Logging - 2.2.0
  • Common.Logging.Core - 2.2.0
  • Common.Logging.Log4Net - 2.0.1

In my web.config I have the following bit:

<configuration>
  <configSections>
   <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
  </configSections>

  //...//

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

  //...//

  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">
        <arg key="configType" value="FILE-WATCH" />
        <arg key="configFile" value="~/log4net.config" />
      </factoryAdapter>
    </logging>
  </common>
</configuration>

How can I fix this?

I've tried changing:

<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">

to (added version of the Common.Logging.Log4net.dll [201])

<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net201">

and that didn't work.

2

There are 2 best solutions below

0
On BEST ANSWER

So I've found the answer to my question and wanted to share the answer with anyone experiencing the same issue.

It looks like between Common.Logging 2.1.2 and Common.Logging 2.2.0 the developer made a change to create a new library Common.Logging.Core. The Common.Logging.Log4Net package hasn't been updated to support the new change according to the Common.Logging development (GitHub) site.

0
On

Another point of view that might help some people:

From Common.Logging 3.0, the developers made a change of how they handle version dependencies, as an example, the assembly Common.Logging.Log4Net would no longer be supported, each of the frameworks would now need a version specific reference. Thus, for Common.Logging.Log4Net, it would be Common.Logging.Log4Net1213 for the latest of this writing.

Using nuget, you could get this by:

Install-Package Common.Logging.Log4Net1213

More information can be found here.