将 spring-boot-starter-log4j2 依赖更换为2.15.0 依赖
<!--<dependency>--> <!--<groupId>org.springframework.boot</groupId>--> <!--<artifactId>spring-boot-starter-log4j2</artifactId>--> <!--</dependency>--> <!-- log4j 新版本依赖 start--> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <version>2.15.0</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.15.0</version> </dependency> <!--不加下面这个依赖mybatis sql日志打印有问题--> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <version>2.15.0</version> <scope>compile</scope> </dependency> <!-- log4j 新版本依赖 end-->