简体   繁体   中英

How to use log4j 2.17.1 in Spring-Boot 1.3.6 with Java-8

My Java-8 project is build using spring-boot 1.3.6 version, Which by default inherit 'log4j-core-2.4.1', but now I want to upgrade log4j-core to 2.17.1 for which I added <log4j2.version>2.17.1</log4j2.version> into pom.xml file of my project. The build runs fine but the error says:-

*ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(Lorg/apache/logging/log4j/core/config/ConfigurationSource;)Lorg/apache/logging/log4j/core/config/Configuration;*

Short answer: you can't .

A breaking change in log4j-core (cf. LOG4J2-1547 ) renders version 2.7.0 and later incompatible with Spring Boot 1.3.x. You can either:

  • upgrade to Spring Boot 1.5.x or later,
  • downgrade to Log4j 2.3.2 (which includes the newest security patches ):
     <properties> <log4j2.version>2.3.2</log4j2.version> </properties>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM