Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable HttpClient wire logging in a Spring Boot 2.0.5 application?

I have a Spring Boot 2.0.5 command-line application with mostly default configurations.

How can I enable HTTPClient wire-logging?

I tried throwing this into a log4j.properties file:

log4j.rootLogger=INFO, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n

log4j.logger.org.apache.http=DEBUG

I tried adding spring-boot-starter-logging to the pom.xml.

I also tried adding JVM parameters to the app launch:

-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
-Dorg.apache.commons.logging.simplelog.showdatetime=true
-Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG

But nothing works. No httpclient logs at all.

How can I get some httpclient logs?

like image 906
Alex R Avatar asked Oct 27 '18 19:10

Alex R


1 Answers

Solution was counter-intuitive. Add this line to application.properties:

logging.level.org.apache.http=DEBUG

like image 145
Alex R Avatar answered Oct 17 '22 07:10

Alex R