springboot中logback和log4j冲突,保留log4j

首先在spring-boot-starter-web中排除spring-boot-starter这个包
然后在spring-boot-starter中排除spring-boot-starter-logging包,此时logback包就被排除了.因为logbak包的上一级parent为spring-boot-starter包

<!--排除spring-boot-starter-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <!-- 去除旧log依赖 -->
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!--引入spring-boot-starter,排除spring-boot-starter-logging-->
        <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>
posted @ 2020-01-29 21:49  未月廿三  阅读(3410)  评论(0编辑  收藏  举报