15

SLF4JLoggerContext cannot be cast to LoggerContext

 4 years ago
source link: https://jimolonely.github.io/2019/09/29/java/073-SLF4JLoggerContext-cannot-be-cast-to-LoggerContext/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

SLF4JLoggerContext cannot be cast to LoggerContext

org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext.

参考https://stackoverflow.com/questions/49688304/slf4jloggercontext-cannot-be-cast-to-loggercontext

解决办法:移除spring-boot-starter-web里的log4j-to-slf4j的依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>

这样产生的结果是:spring的日志输出将轮为logback,而其他日志使用log4j

Share


Recommend

  • 32
    • bryantchang.github.io 6 years ago
    • Cache

    log4j2源码解析(2)--LoggerContext

    LoggerContext作用及初始化流程 根据我们在Log4j初识中的实例可以看出,在不适用日志门面插件slf4j的情况下,获取logger的方式一般为 Logger logger = logManager.getLogger(xx.class) 可以看到,通常...

  • 64
    • blog.guoyb.com 6 years ago
    • Cache

    关于dynamic_cast

    有时候,项目需求紧,时间少,写代码往往就抓起什么用什么,比较少考虑设计的合理性。dynamic_cast就是一例。 dynamic_cast一般用于down cast,即将父类的指针(或引用)转换成子类的指针(或引用),并提供了运行时的类型检查(...

  • 15

    (This article was first published on R-posts.com , and kindly contributed toR-bloggers) In my da...

  • 33
    • studygolang.com 5 years ago
    • Cache

    Go 每日一库之 cast

    简介 今天我们再来介绍 spf13 大神的另一个库 cast 。 cast 是一个小巧、实用的类型转换库,用于将一个类型转为另一个类型。 最初开发 cast

  • 5
    • technomancy.us 4 years ago
    • Cache

    in which many rays are cast

    in which many rays are cast The Lisp Game Jam is a semiannual tradition I enjoy participating in. Th...

  • 13

    My 1st screen cast: awk program from scratch Kaushik Gopal Two big announcements: I made my first screen cast

  • 10

    什么是父类指针 父类指针也可以称为基类指针,当父类(基类)指针指向派生类(子类)指针的时候,可以触发“多态的效果”。不过本文的重点不在“多态”,而是聊聊当父类指针和子类指针互相赋值时需要注意的问题。

  • 17

    Episode 184 Episode 184 - Stop Being A One Trick Pony What's that one trick you always use to solve...

  • 15

    Chemistry of Cast Iron Seasoning: A Science-Based How-ToThe post after this one on “black rust” describes why you should heat the pan before applying oil for seasoning. This helps the seasoning to adhere and makes the pan pleasantly bl...

  • 11
    • www.thejavaprogrammer.com 3 years ago
    • Cache

    Solved Error: cannot be cast to java.lang.Comparable

    Solved Error: cannot be cast to java.lang.ComparableThis article will look at how to solve the above-given Class Cast Exception. This ClassCast Exception occurs at runtime when we improperly typecast an object of a class to a related...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK