• 解决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

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

  • 相关阅读:
    测试的种类
    软件测试的原则
    软件测试的目的
    软件测试的对象
    软件的分类
    软件测试
    mysql 视图
    mysql 字段添加以及删除
    mysql 引擎类型
    mysql 数据插入insert
  • 原文地址:https://www.cnblogs.com/SunshineKimi/p/10540376.html
Copyright © 2020-2023  润新知