log4j 2 - configuration issue

前端 未结 12 738
执笔经年
执笔经年 2020-12-10 12:34

I am trying to configure log4j 2.0 to report logs.

My config is saved as log4j2.xml and this is its content:

  

        
12条回答
  •  失恋的感觉
    2020-12-10 13:00

    In the documentation of log4j 2: http://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration

    "If a JSON file cannot be located the XML ConfigurationFactory will try to locate log4j2.xml on the classpath."

    but it is not working with classpath. Instead if we keep it in src folder, then it is working.

    
        log4jConfiguration
        log4j2.xml
    
    

    similar problem is mentioned here : https://issues.apache.org/jira/browse/LOG4J2-357

提交回复
热议问题