zoukankan      html  css  js  c++  java
  • springboot日志

    1、
    java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

    去掉spring-boot-starter-actuator里的 log4j-to-slf4j 即可。

    <exclusions>
                    <exclusion>
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-to-slf4j</artifactId>
                    </exclusion>
                </exclusions>
    

    2、

    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/Users/guanliyuan/mrepo_data_dev/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/Users/guanliyuan/mrepo_data_dev/org/apache/logging/log4j/log4j-slf4j-impl/2.11.2/log4j-slf4j-impl-2.11.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/Users/guanliyuan/mrepo_data_dev/org/slf4j/slf4j-log4j12/1.7.30/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
    

    分析:
    1、springboot使用的日志依赖

    2、其他组件使用的日志依赖

    这几个个包的一个实现类包名一样


    解决:
    mvn dependency:tree
    去掉log4j-slf4j-impl与slf4j-log4j12

    <exclusion>
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-slf4j-impl</artifactId>
                    </exclusion>
    
    
    <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                </exclusions>
    
    
  • 相关阅读:
    Asp.net HttpContext 简介
    cxf 调用 .net webservice
    Dapper.Rainbow 简单使用
    Aspose.words 书签定位
    修改WCF的默认序列化格式
    mysql8.0.18忘记密码后重置密码
    聊一聊c#中的MATH.ROUND方法
    Windows上安装MySql
    win7搭建本地SonarQube环境进行c#代码分析
    使用dapper遇到的问题及解决方法
  • 原文地址:https://www.cnblogs.com/cashew/p/14393567.html
Copyright © 2011-2022 走看看