[Question]: Spring boot integrates log4j to solve the conflict with logback
[the reason]:
This is because the conflict with logback has not been resolved, resulting in startup failure.
[Solution]:
According to the above error message, find the corresponding positions of logback-classic-1.2.3.jar and slf4j-log4j12-1.7.25.jar and delete them, and add the following exclusion code in pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 排除默认的logback日志,使用log4j-->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
Start found that everything is normal, so far, the configuration of log4j is complete.