首先搞清楚SLF4J和log4j是啥子关系,
然后 https://logging.apache.org/log4j/2.x/log4j-slf4j-impl/
The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation.
Due to a break in compatibility in the SLF4J binding, as of release 2.11.1 two SLF4J to Log4j Adapters are provided.
1. log4j-slf4j-impl should be used with SLF4J 1.7.x releases or older.
2. log4j-slf4j18-impl should be used with SLF4J 1.8.x releases or newer.
Applications that take advantage of the Java Module System should use SLF4J 1.8.x and log4j-slf4j18-impl
log4j-slf4j-impl should be used with SLF4J 1.7.x releases or older.
log4j-slf4j18-impl should be used with SLF4J 1.8.x releases or newer.
所以排查下项目正真使用的SLF4J版本是不是1.8以上的,如果是,请使用log4j-slf4j18-impl
,一般是引入新依赖覆盖导致这个问题。