NLog v2可以与Common.Logging一起使用吗 [英] Can NLog v2 be used with Common.Logging

查看:167
本文介绍了NLog v2可以与Common.Logging一起使用吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天尝试一起使用它们,但由于它正在寻找NLog v1,因此版本不匹配.

I tried using these together today, and was getting a version mismatch, as it's looking for NLog v1.

Common.Logging是否支持NLog v2?

Does Common.Logging support NLog v2 yet?

如果没有,有谁知道是否可以安全地使用程序集版本重定向?

If not, does anyone know if an assembly version redirect can safely be used?

推荐答案

您可以简单地在app.config或web.config中进行程序集重定向,并且通过使用NLog2作为日志记录框架,CommonLogging可以在NLog2上正常工作:

You can simply do assembly redirect in app.config or web.config, and CommonLogging will just work fine with NLog2 by using NLog2 as logging framework:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

唯一的问题是,如果要使用CommonLogging 2.0将NLog消息重定向到其他日志记录框架,则存在兼容性问题.但这是一个非常不寻常的用例.

The only issue is if you want to redirect NLog message to some other logging framework using CommonLogging 2.0, then there is a compatibility issue. But that is a very unusual use case.

这篇关于NLog v2可以与Common.Logging一起使用吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆