No log4j2 configuration file found. Using default configuration: logging only errors to the console

前端 未结 15 1108
情深已故
情深已故 2020-12-04 22:59
$ java -Dlog4j.configuration=file:///path/to/your/log4j2.xml -jar /path/to/your/jar_file.jar

Written to the console, you get

ERROR          


        
15条回答
  •  遥遥无期
    2020-12-04 23:50

    This sometimes can be thrown before the actual log4j2 configuration file found on the web servlet. at least for my case I think so. Cuz I already have in my web.xml

      
        log4jConfiguration
        classpath:log4j2-app.xml
      
    

    and checking the log4j-web source; in class

    org.apache.logging.log4j.web.Log4jWebInitializerImpl
    

    there is the line;

    String location = this.substitutor
                     .replace(this.servletContext.getInitParameter("log4jConfiguration"));
    

    all those makes me think that this is temporary log before configuration found.

提交回复
热议问题