使用Common.Logging与log4net的组件版本兼容问题
引用:
近期使用了Common.Logging的ILog接口做日志接口,同时利用其log4net适配器与log4net记录器来记录系统日志,在使用过程中碰到了log4net版本问题。
项目组件管理中安装组件包:
PM> Install-Package Common.Logging
PM> Install-Package Common.Logging.Log4Net 【2.0.1版本;依赖Common.Logging (≥ 2.0.0); log4net (= 1.2.10)】
项目中将引用log4net.dll版本为 1.2.10.0,在此配套版本情况下,运行出现错误: {"Unable to create type 'Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net'"}
也 将log4net组件升级到最新版本1.2.13失败,Install-Package : 将“log4net 1.2.10”更新到“log4net 2.0.3”失败。找不到与“log4net 2.0.3”兼容的“Common.Logging.Log4Net”版本。
将Common.Logging.Log4Net版本删除,重新安装以下版本
PM> Install-Package Common.Logging.Log4Net1211 【2.2.0版本;Common.Logging (≥ 2.0.0);Log4Net (≥ 1.2.11)】
项目中log4net.dll版本为 1.2.11.0, 运行OK,升级log4net1.2.13版本,升级成功,运行OK;
注意配置文件中程序集文件名差异
<common> <logging> <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1211">
版本重定向
<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> <dependentAssembly> <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.2.13.0" newVersion="1.2.13.0" /> </dependentAssembly> </assemblyBinding>
原因主要是由于log4net version 1.2.11与1.2.10的publicKeyToken不同所致。可利用VS工具SN –T 组件文件名.dll查看公钥。
log4net (≥ 1.2.11) 公钥标记为 669e0ddf0bb1aa2a
log4net (= 1.2.10) 公钥标记为 1b44e1d426115821
http://www.nuget.org/packages/Log4Net/
http://www.nuget.org/packages/Common.Logging/
http://www.nuget.org/packages/Common.Logging.Log4Net1211/
http://www.nuget.org/packages/Common.Logging.Log4Net/
http://developer.3l.nl/post/16463925249/log4net-1-2-11-dependency-hell
把项目做成了服务,结果怎么使用,都报错, 于是,直接在服务里,有添加"引用"了一边 3个DLL,才算是好使,
很纠结原因是什么...
使用Common.Logging与log4net的组件版本兼容问题的更多相关文章
- Net dll组件版本兼容问题
dll组件版本兼容问题,是生产开发中经常遇到的问题,常见组件兼容问题如:Newtonsoft.Json,log4net等 为了节约大家时间,想直接看解决方法的,可直接点击目录3.4 目录 1.版本兼容 ...
- Common.Logging log4net Common.Logging.Log4Net 配置
1.log4net 单独配置 log4net支持多种格式的日志输出,我这里只配置输出到本地的txt文件这种格式. <log4net> <root> <appender-r ...
- 基于Common.Logging + Log4Net实现的日志管理
前言 Common.Logging 是Commons-Logging(apache最早提供的日志门面接口,提供了简单的日志实现以及日志解耦功能) 项目的.net版本.其目的是为 "所有的.n ...
- 使用Common.Logging+log4net规范日志管理
Common.Logging+(log4net/NLog/) common logging是一个通用日志接口,log4net是一个强大的具体实现,也可以用其它不同的实现,如EntLib的日志.NLog ...
- 使用Common.Logging+log4net规范日志管理【转载】
使用Common.Logging+log4net规范日志管理 Common.Logging+(log4net/NLog/) common logging是一个通用日志接口,log4net是一个强大 ...
- Comon.Logging与Log4net联合使用
1.摘要 Common.Logging定义了一种接口的公共接口,尤其在Quartz.net中作为接口型的组件,而具体则使用log4net,nlog等组件. 2.使用步骤 Install-Package ...
- Net dll版本兼容问题
Net dll组件版本兼容问题 https://www.cnblogs.com/newP/p/9543528.html dll组件版本兼容问题,是生产开发中经常遇到的问题,常见组件兼容问题如:Newt ...
- Common.Logging源码解析一
Common.Logging是Apache下的一个开源日志接口组件,主要用于切换不同的日志库,因为当前流行的日志库有很多向log4j.log4net(log4j的.net版本)等等,所以为了能灵活的切 ...
- Common.Logging源码解析二
Common.Logging源码解析一分析了LogManager主入口的整个逻辑,其中第二步生成日志实例工厂类接口分析的很模糊,本随笔将会详细讲解整个日志实例工厂类接口的生成过程! (1).关于如何生 ...
随机推荐
- 使用firbug调试程序写更高质量的代码设置方法
在搜狐浏览器内输入about:config 在搜索栏中输入:strict 双击javascript.options.strict,将值变为true
- The certificate that was used has a trust chain that cannot be verified问题
今天调用wcf程序的时候发现证书有问题.报的错误如下 The certificate that was used has a trust chain that cannot be verified. ...
- jq小demo—图片翻页展示效果 animate()动画
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- SpringMVC通过注解获得参数
SpringMVC可以通过RequestParam注解来映射获得参数,具体用法如下: 例子: 配置过程省略 1.新建controller类 package com.loger.controller; ...
- javaWEB总结(11):JSP简介及原理
前言 本文主要通过一个简单小例子,介绍JSP的原理. 1.项目结构 2.web.xml <?xml version="1.0" encoding="UTF-8&qu ...
- CodeForces 703C Chris and Road
数学,递推. 不知道有没有更加神奇的做法,我是这样想的: 首先,如果多边形完全在$y$轴左侧,那么答案为$\frac{w}{u}$. 剩下的情况就要先判断是否能在车开过之前跑过去,如果跑不过去,要在车 ...
- jQuery切换网页皮肤并保存到Cookie示例代码
经过使用,靠谱! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww ...
- 第九十六节,JavaScript概述
JavaScript概述 学习要点: 1.什么是JavaScript 2.JavaScript特点 3.JavaScript历史 4.JavaScript核心 5.开发工具集 JavaScript诞生 ...
- c# delegate的invoke和bejinInvoke的区别
先看下面实实例代码 private delegate void testdg(); private void button1_Click(object sender, EventArgs e) ...
- 用VMware vSphere Client客户端登陆vsphere5提示错误
客户端无法向服务器发送完整请求(基础连接已关闭:发送时发生错误) 可能原因:5.1以上的vsphere client都不支持winxp