Springboot中使用log4j2需要移除默认的logback,pom文件如下:
<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><exclusion><artifactId>logback-classic</artifactId><groupId>ch.qos.logback</groupId></exclusion></exclusions>
</dependency>
项目添加log4j2后,发现配置文件不生效,检查maven依赖,还有logback相关包存在,尝试从全局去除logback,解决
<dependency><groupId>org.springframework.boot</groupId><artifactId>logback-classic</artifactId><exclusions><exclusion><groupId>*</groupId><artifactId>*</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-logging</artifactId><exclusions><exclusion><groupId>*</groupId><artifactId>*</artifactId></exclusion></exclusions></dependency>
本文链接:https://my.lmcjl.com/post/12530.html
展开阅读全文
4 评论