spring boot更换日志为log4j2

<dependency>  
    <groupId>org.springframework.boot</groupId>  
    <artifactId>spring-boot-starter</artifactId>  
    <exclusions>  
        <exclusion>  
            <groupId>org.springframework.boot</groupId>  
            <artifactId>spring-boot-starter-logging</artifactId>  
        </exclusion>  
    </exclusions>  
</dependency> 

<!-- 添加 log4j 依赖 -->  
<dependency>  
    <groupId>org.springframework.boot</groupId>  
    <artifactId>spring-boot-starter-log4j</artifactId>  
</dependency>

关于移除:如果不做移除会报类冲突。

之后在resources中添加log4j2.xml即可

原文地址:https://www.cnblogs.com/flying607/p/7826293.html