springboot使用log4j启动报错,去除重复包则报以下找不到log4j错误,不去重则报包重复错误,请指教

log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.10.RELEASE)

[2019-05-07 22:53:30.924] - 13452 信息 [main] --- org.apache.catalina.core.StandardService: Starting service [Tomcat]
[2019-05-07 22:53:30.928] - 13452 信息 [main] --- org.apache.catalina.core.StandardEngine: Starting Servlet Engine: Apache Tomcat/8.5.27
[2019-05-07 22:53:31.104] - 13452 信息 [localhost-startStop-1] --- org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]: Initializing Spring embedded WebApplicationContext
[2019-05-07 22:53:31.617] - 13452 信息 [main] --- org.apache.catalina.core.StandardService: Stopping service [Tomcat]

去除重复包操作为:

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>logback-classic</artifactId>
                    <groupId>ch.qos.logback</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>log4j-over-slf4j</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>

log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
这个不是报错,是告警,说明你没有配置 log4j 配置文件。你把 resource 目录下放一个log4j.properties 文件试试。