有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

将spring boot从1.3.5更新到1.5.17后,未找到java log4j库

我将spring boot从1.3.5升级到1.5.17,并且找不到log4j库。 错误表示错误:(10,24)java:package-org。阿帕奇。log4j不存在。 这是我的pom。xml

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.17.RELEASE</version>
    <relativePath />
</parent>
<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-log4j</artifactId>
</dependency>
<dependency>
     <groupId>org.springframework.kafka</groupId>
     <artifactId>spring-kafka</artifactId>
     <version>1.3.8.RELEASE</version>
</dependency>
<dependency>
     <groupId>org.apache.kafka</groupId>
     <artifactId>kafka_2.10</artifactId>
     <version>0.8.2.2</version>
 <exclusions>
    <exclusion>
      <groupId>org.apache.zookeeper</groupId>
      <artifactId>zookeeper</artifactId>
    </exclusion>
    <exclusion>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </exclusion>
  </exclusions>
</dependency>

共 (1) 个答案

  1. # 1 楼答案

    自Spring Boot 1.4以来,支持log4j 1。x已被删除,如release notes of Spring boot 1.4中所示:

    Log4j 1 support has been removed following Apache EOL announcement.

    他们建议升级到log4j 2。x、 这可以通过使用以下依赖项来完成:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j2</artifactId>
    </dependency>