Enable debug logging for Log4J2 + Apache HttpClient

后端 未结 2 2044
慢半拍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:55

    Remko is right that the issue is httpcomponents using log4j-1.2 internally. The adaptor that routes log4j 1.2 to log4j 2 is called the log4j 1.2 bridge and is described here: https://logging.apache.org/log4j/2.x/log4j-1.2-api/index.html.

    The maven artifacts page for log4j explains exactly how to configure your maven dependencies to include the bridge library:

    Log4j 1.x API Bridge

    If existing components use Log4j 1.x and you want to have this logging routed to Log4j 2, then remove any log4j 1.x dependencies and add the following.

    
      
        org.apache.logging.log4j
        log4j-1.2-api
        2.5
      
    
    

    From https://logging.apache.org/log4j/2.x/maven-artifacts.html

提交回复
热议问题