zoukankan      html  css  js  c++  java
  • 解决springdatajpa与log4j的冲突

    springdatajpa中是使用'spring-boot-starter-logging',在饮用水log4j时就会产生冲突报错,错误信息如下:

    Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.imagego.smartcity.mars.server.device.proto.DeviceProtoApplication.main(DeviceProtoApplication.java:10)
    Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl cannot be present with log4j-to-slf4j
    at org.apache.logging.slf4j.Log4jLoggerFactory.validateContext(Log4jLoggerFactory.java:49)
    at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:39)
    at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:30)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:54)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:30)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
    at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
    at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
    at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:196)
    ... 1 more

    可以去掉对这个包的依赖,在gradle.build中添加即可

    configurations {
        //排除对默认logging的依赖
        compile.exclude module: 'spring-boot-starter-logging'
    }
  • 相关阅读:
    数据分析之异常值分析-箱线图
    PHP学习路线图(转)
    学习简易爬虫设计(转)
    学习扫码登录的例子
    2017年PHP程序员未来路在何方(转)
    一个PHP开发APP接口的视频教程
    PHP实现Restful风格的API(转)
    大型网站技术架构-入门梳理(转)
    PHP面试总结(转)
    大型网站系统架构的演化(转)
  • 原文地址:https://www.cnblogs.com/yangshixiong/p/12370564.html
Copyright © 2011-2022 走看看