相关疑难解决方法(0)

NLog 给出异常可能的解释是缺少零 arg 和单个 arg Common.Logging.Configuration.NameValueCollection 构造函数

我将 NLog 添加到我的应用程序和它的测试项目中。它们都是同一个解决方案的一部分。从应用程序内部 NLog 工作。但是从测试项目得到以下异常:

Unable to create instance of type Common.Logging.NLog.NLogLoggerFactoryAdapter. Possible explanation is lack of zero arg and single arg Common.Logging.Configuration.NameValueCollection constructors
Run Code Online (Sandbox Code Playgroud)

我的 NLog 配置如下:

    <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.1.2.0" newVersion="2.1.2.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>    
    <common>
            <logging>
              <factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
                <arg key="configType" value="INLINE" />
              </factoryAdapter>
            </logging>
          </common>
          <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" internalLogFile="C:\git\foo\logs\nlog.log" internalLogLevel="Warn">
            <extensions>
              <add assembly="NLog.RollbarSharp" />
            </extensions>
            <targets>
              <target xsi:type="RollbarSharp" name="Rollbar" …
Run Code Online (Sandbox Code Playgroud)

c# logging nlog nuget apache-commons-logging

6
推荐指数
1
解决办法
3051
查看次数

标签 统计

apache-commons-logging ×1

c# ×1

logging ×1

nlog ×1

nuget ×1