http://blog.sina.com.cn/s/blog_54eb26870100uynj.html

到SLF4J官方网站:http://www.slf4j.org/codes.html#log4j_version

有如下说明:

The trace level was added to log4j in version 1.2.12 released on August 29, 2005. The trace level was added to the SLF4J API in version 1.4.0 on May 16th, 2007. Thus, starting with SLF4J 1.4.0, the log4j binding for SLF4J requires log4j version 1.2.12 or above.

从上面的说明可以看出,SLF4J用到了log4j的 trace 级别。

下载slf4j包, http://www.slf4j.org/dist/slf4j-1.6.4.zip

打开源码文件:
slf4j-1.6.4\slf4j-log4j12\src\main\java\org\slf4j\impl\StaticLoggerBinder.java

发现有下面的定义:

import org.apache.log4j.Level;
.......

private StaticLoggerBinder() {
   
loggerFactory = new Log4jLoggerFactory();
    try {
     
Level level = Level.TRACE;
    } catch
(NoSuchFieldError nsfe) {
     
Util.report("This version of SLF4J requires
log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version");

}
  }

从上面看出,如果org.apache.log4j.Level 没有TRACE属性,会报错“This version of SLF4J requires log4j version 1.2.12 or
later. See also http://www.slf4j.org/codes.html#log4j_version

这个异常是由于Level类没有静态属性TRACE抛出的,
因此解决办法有两个:
1、找到org.apache.log4j.Level中定义了TRACE属性的jar包,经过查找,log4j-1.2.15
这个版本有定义。

2、用SLF4j中自定义的org.apache.log4j.Level类,它重写了Level类。
  
我用的版本是slf4j-1.6.4.zip,可以从官方下载,里面有个jar包:log4j-over-slf4j-1.6.4.jar

把这个jar包放入web-info/lib下面即可,同时,要保证log4j-over-slf4j-1.6.4.jar优先装载。

SLF4J versions 1.4.0 and later requires log4j 1.2.12 or later 终极解决的更多相关文章

  1. Wndows 下npm 安装依赖时出现错误:MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".

    当在Windows环境中使用npm install或者yarn 安装依赖时,可能会出现如下类似的错误: MSBUILD : error MSB4132: The tools version " ...

  2. this version of SLF4J requires log4j version 1.2.12 or later.

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ...

  3. windows server 2003 64x 读取office数据终极解决办法 The 'Microsoft.Jet.OLEDB.4.0' provider is not registered

    微软老子信了你的邪!      试了各种办法没有效果 网友解决办法一: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the ...

  4. VC++6.0 下配置 pthread库2010年12月12日 星期日 13:14VC下的pthread多线程编程 转载

    VC++6.0 下配置 pthread库2010年12月12日 星期日 13:14VC下的pthread多线程编程     转载 #include <stdio.h>#include &l ...

  5. Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000fa980000, 59244544, 0) failed; error='Cannot allocate memory' (errno=12)

    启动项目报错 Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000fa980000, 592445 ...

  6. OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Out of memory' (errno=12)

    使用docker 安装kafka时启动失败 查看报错日志 # docker logs --since 30m 71846a96e514 Excluding KAFKA_HOME from broker ...

  7. Vue2.0 【第一季】第3节 v-for指令:解决模板循环问题

    目录 Vue2.0 [第一季] 第3节 v-for指令:解决模板循环问题 第三节 v-for 指令 一.基本用法: 二.排序 三.对象循环输出 Vue2.0 [第一季] 第3节 v-for指令:解决模 ...

  8. make[2]: *** No rule to make target `/root/.pyenv/versions/anaconda3-2.4.0/lib/libpython3.5m.so', needed by `evaluation.so'. Stop.

    当出现No rule to make target ,肯定是Makefile有问题. 有的makefile是脚本生成的,你得看脚本的配置文件对不对. 我的是这个脚本生成的.发现是Pythondir的配 ...

  9. java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext问题原因及解决方法

    一.错误信息 java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logb ...

随机推荐

  1. linux nginx大量TIME_WAIT的解决办法--转

    netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' TIME_WAIT 8535 CLOSE_WAIT 5 FIN ...

  2. 电脑蓝屏提示unexpected store exception的解决方法

    在我们使用电脑的过程中常常会遇到许多问题,对于许多不熟悉电脑的用户常常摸不着头脑,而部分用户在使用电脑时,电脑常常出现蓝屏的情况,并提示你的电脑遇到问题需要重新启动,与此同时,其报告错误代码为“une ...

  3. 【Android开发日记】之入门篇(八)——Android数据存储(下)

    废话不多说了,紧接着来讲数据库的操作吧.Come On! 提到数据存储问题,数据库是不得不提的.数据库是用来存储关系型数据的不二利器.Android为开发者提供了强大的数据库支持,可以用来轻松地构造基 ...

  4. js实现图片懒加载

    大型购物网站都会采用图片懒加载技术来优化网站首页打开速度,以提高用户体验,那么具体是怎么实现的呢,我们一探究竟. html结构(div包裹一层用来显示背景图片,等待图片加载完成后,显示真实图片) &l ...

  5. day09作业

    一.填空题 1.方法 2.堆内存 3.构造方法 4.this 5.this 6.static 7.使用类名进行访问 8.package import class 9.关键字 10.lang 二.选择题 ...

  6. java基础53 IO流技术(转换流)

    1.转换流 1.输入字节的转换流:InputStreamReader是字节流转为字符流的桥梁,可以把输入字节流转换为输入字符流    2.输出字节流的转换流:OutputStreamWriter是字符 ...

  7. Hexo命令无法找到 -问题修复

    本人PC安装hexo按照官方npm方式下载: npm install -g hexo-cli 但是到了控制台,输入hexo总是无法找到该命令,提示:Command not Found!!!,无论git ...

  8. TStringList 与 泛型字典TDictionary 的 哈希功能效率PK

    结论: 做HashMap 映射 功能的时候 ,字典TDictionary 功能更强大,且效率更高,比如不仅仅可以存String,还可以存结构和类. TDictionary类是一个name,value容 ...

  9. (六)MyBatis杂项

    第一节:处理CLOB.BLOB类型数据 第二节:传入多个输入参数 第三节:MyBatis分页 1,逻辑分页 2,物理分页 MyBatis默认情况下,MyBatis启用一级缓存,即同一个SqlSessi ...

  10. HA下的Spark集群工作原理解密

    实验环境: zookeeper-3.4.6 Spark:1.6.0 简介: 本篇博客将从以下几点组织文章: 一:Spark 构建高可用HA架构 二:动手实战构建高可用HA 三:提交程序测试HA 一:S ...