ERROR StatusLogger Log4j2 could not find a logging implementation

前端 未结 3 1464
暗喜
暗喜 2020-12-06 16:05

I am trying to implement log4j 2 but it keeps throwing the following error.

> ERROR StatusLogger Log4j2 could not find a logging implemen         


        
相关标签:
3条回答
  • 2020-12-06 16:41

    To get around a similar issue with Spring Boot I added

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

    to my POM

    0 讨论(0)
  • 2020-12-06 16:45

    This dependency help to avoid this error from lambda.

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-to-slf4j</artifactId>
        <version>2.8.2</version>
    </dependency>
    
    0 讨论(0)
  • 2020-12-06 16:54

    Solved the error message by setting the system property for log4j2 configuration file. below is the below code.

    System.setProperty("log4j.configurationFile","./path_to_the_log4j2_config_file/log4j2.xml");
    
    Logger log = LogManager.getLogger(LogExample.class.getName());
    
    0 讨论(0)
提交回复
热议问题