• 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>
    
    
  • 相关阅读:
    jquery:class选择器(父子关系)
    jquery:跳转网页
    jquery:获得当前点击对象 : $(this)
    jquery:向后台提交数组
    03 适配器 代理 外观 装饰者
    02 工厂模式
    01 单例模式 Singleton
    设计模式概论与原则 & UML类图
    06 JDBC & ORM
    05 注解与反射 & JVM
  • 原文地址:https://www.cnblogs.com/cashew/p/14393567.html
Copyright © 2020-2023  润新知