From your analysis, it seems that you expect RestTemplate to use Apache HttpClient.
However, by default, Spring RestTemplate does not use Apache HttpClient, but uses JDK objects (java.net.URL # openConnection (), etc.) using SimpleClientHttpRequestFactory.
org.springframework.http.client.support.HttpAccessor declares:
private ClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
As far as I know, this client does not support logging of requests / responses.
To change the RestTemplate to use HttpClient, try the following:
new RestTemplate(new HttpComponentsClientHttpRequestFactory());
The logging configuration should then include the org.apache.http.wire level org.apache.http.wire category to complete all requests / responses.
Geert
source share