LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback
时间: 2023-11-11 10:57:55 浏览: 111
这个错误通常是由于在使用SLF4J时引入了多个日志框架导致的,解决这个问题的方法一般是排除冲突的依赖项或者将其他的日志框架从项目中删除。比如可以将其他的日志框架依赖排除掉,只保留logback依赖。具体可参考以下代码:
```
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
```
阅读全文