Enable debug logging for Log4J2 + Apache HttpClient

后端 未结 2 2041
慢半拍i
慢半拍i 2021-01-04 16:31

im trying to activate the debug logging for my Apache HttpClient but cant make it work (getting no logging output at all which is HttpClient related).

This is my log

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 16:46

    I am assuming that httpcomponents use log4j-1.2 internally. Log4j2 provides an adapter that routes calls from your application that use the 1.2 API to the new 2.0 implementation.

    To enable this, you only need to add log4j-core and log4j-1.2-api jars to your classpath. (Your current Maven dependencies only has log4j-api, which is the new 2.0 API.) See also http://logging.apache.org/log4j/2.x/faq.html .

提交回复
热议问题