解决java log4j 配置log4jCaused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager

前提安装http://mirror.bit.edu.cn/apache/logging/log4j/2.11.2/apache-log4j-2.11.2-bin.zip

Buildpath 配置add extend jar :   log4j-1.2.17.jar

project/src/下 新建log4j配置文件

安装完成配置完后依然报错Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager

解决:查看原来是有2个含有 org.apache.logging.log4j.LogManager 类的的包导致一个是之前接口httpclent-api-log4j的,一个是上面下载的

删除http-api-log4j问题解决

送上配置log4.jproperties

### log output control D is debug log output is or not ,E is ERROR OUTPUT is or not control by have D ,E manual control
log4j.rootLogger = error,stdout,D,E

### console logs ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n

### debug log ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = ./logs/debug/debug.log
log4j.appender.D.Append = true
log4j.appender.D.Threshold = DEBUG
log4j.appender.D.layout = org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n

###error logs ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File = ./logs/error/error.log
log4j.appender.E.Append = true
log4j.appender.E.Threshold = ERROR
log4j.appender.E.layout = org.apache.log4j.PatternLayout
log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n

---------------------

原文地址:https://www.cnblogs.com/SunshineKimi/p/10540376.html

时间: 2024-11-11 13:36:44

解决java log4j 配置log4jCaused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager的相关文章

mybatis + log4j2 问题 java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/AbstractLoggerWrapper

root cause java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/AbstractLoggerWrapper 网上资料比较少,最后查到是mybatis 3.2.7的bug,升级到3.3.0就好了 详见:https://github.com/mybatis/mybatis-3/issues/234  emacarron modified the milestone: 3.2.8, 3.3.0 on 10 Oct 2014

java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource解决方法

java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource解决方法 只需把这三个commons-pool.jar.commons-dbcp-1.2.2.jar和commons-collections-3.2.jar包加入到lib里即可解决.这三个包在你本地的tomcat下的lib里,直接buildpath导入就行了,不过有时导包不一定好使,是因为工程lib下的包跟tomcat下的包重复了,导致异常错误如: o

java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory的解决办法

Tomcat7早就出来正式版,但是一直都没有用过,尤其是针对于我还一直在用Myeclipse6.5的人来说,它在配置tomcat的时候没有tomcat7的选项,所以就报了错误信息. [java] view plaincopy java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:60)

已解决:java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.com.yourproject.test_jsp

同事遇到了一个问题,开始项目运行的好好的,过了一段时间再访问页面会报出如下错误信息(只贴了部分), 这是为啥呢,可能是由于servlet-api版本jar包重复导致的,他项目本身使用了servlet-api(pom.xml中引用), 通过eclipse部署tomcat,tomcat中也包含了servlet-api.jar,而且这两个jar包版本不一致.换成版本一致的重新部署之即可, java.lang.ClassNotFoundException: org.apache.jsp.WEB_002d

解决:java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject报错问题。

利用POI操作PPT一直报如下错误java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject 是因为项目中缺少一个包xmlbeans-2.3.0.jar,加上后就可以正常操作了. 官方下载地址:http://xmlbeans.apache.org 导入XMLBEANS包即可 原文地址:https://www.cnblogs.com/yang-xiansen/p/11972187.html

Caused by: java.lang.ClassNotFoundException: org.apache.shiro.spring.LifecycleBeanPostProcessor

1.错误描述 Caused by: java.lang.ClassNotFoundException: org.apache.shiro.spring.LifecycleBeanPostProcessor at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRe

java.lang.ClassNotFoundException: org.apache.commons.dbutils.QueryRunner

七月 28, 2017 11:06:33 下午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet [com.itheima.transfer.web.TransferServlet] in context with path [/WEB19] threw exception [Servlet execution threw an exception] with root ca

Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils

1.错误描述 警告: Could not create JarEntryRevision for [jar:file:/D:/MyEclipse/apache-tomcat-7.0.53/webapps/FirstSSH/WEB-INF/lib/struts2-core-2.3.16.3.jar]! java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils at com.opensymphony.xwork2.util.fs.

Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils

1.错误描述 2014-7-10 23:12:23 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter struts2 java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils at com.opensymphony.xwork2.config.providers.XmlConfigurationProv