UpT*_*eek 9 logging nlog common.logging
我今天尝试使用这些,并且正在寻找版本不匹配,因为它正在寻找NLog v1.
Common.Logging是否支持NLog v2?
如果没有,是否有人知道是否可以安全地使用程序集版本重定向?
你可以在app.config或web.config中简单地进行程序集重定向,通过使用NLog2作为日志框架,CommonLogging可以正常使用NLog2:
<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>
Run Code Online (Sandbox Code Playgroud)
唯一的问题是如果要使用CommonLogging 2.0将NLog消息重定向到其他日志框架,则存在兼容性问题.但这是一个非常不寻常的用例.