-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Prevent HttpClient 4.x from spamming the log with DEBUG messages from .wire and .content loggers when using logback-spring.xml #32976
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? No Sign in to your account
Comments
Unfortunately, I cannot reproduce the behaviour that you have described. For example, we have smoke tests that use Spring Framework's
This would suggest that the logging is being performed before the If the above does not help and you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue. |
Ok, I will investigate more. The |
No, I don't think so. Logback's defaults only apply until |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Spring Boot 2.7.5
spring-boot-starter-logging 2.7.5
When running tests, HttpClient 4.x in RestTemplate spams the log with so many entries that it makes the test suite fail in GitLab CI.
The setup is quite standard. The project had no extra logging setup until the tries to prevent this issue.
Below are the files on the classpath (a Maven project, in
src/main/resources
)Trying different loggers (
org.apache.http.headers
should be the right one) for the version used byRestTemplate
in Framework 5.3)logback-spring.xml:
Trying to set it in a different way:
application.properties:
Trying in case httpclient logs through log4j:
log4j.properties:
Trying to change the logger in case httpclient logs through log4j
commons-logging.properties:
But none of this worked. Still, the output is spammed with things like
Since I am following the documentation of Spring Boot and Spring Framework regarding logging, these should work.
But primarily, turning this off should be a matter of Spring Boot itself, even programatically, since it uses an obsolete logging library which is not supported since 2020.
Not sure if anyone is going to fix this since Framework 6.x will use HttpClient 5.x, for which the logging configuration works. But it would be great, as this is a blocker.
EDIT Eventually, one thing worked: Renaming
logback-spring.xml
tologback.xml
. It seems that somehow, propagating the config to whatever layer HttpClient uses, needs to happen in the earlier logging setup stage. So that's what needs to be fixed, if possible, or documented, if not.The text was updated successfully, but these errors were encountered: