Log4j2 could not find a logging implementation with Spring Boot

后端 未结 4 2108
走了就别回头了
走了就别回头了 2020-12-18 00:02

I\'m getting this error trying to use log4j2 with spring boot.

ERROR StatusLogger Log4j2 could not find a logging implementation. 
Please add log4j-core to t         


        
4条回答
  •  心在旅途
    2020-12-18 00:17

    It looks your dependencies are correct. This is the pom of working spring-boot application with log4j2 as logging framework:

        
        
            org.springframework.boot
            spring-boot-starter
            
                
                    org.springframework.boot
                    spring-boot-starter-logging
                
            
        
        
            org.springframework.boot
            spring-boot-starter-log4j2
               
    

    Put your log4j2.xml into resource folder for running from eclipse; if you prefer to use the different directory - resource/conf - provide the path to log4j2 configuration with JVM argument like this:

    -Dlog4j.configurationFile=”conf/log4j2.xml”

    Do not give up and switch back from logback to log4j2...

提交回复
热议问题