Align AsyncRestTemplate error logging with RestTemplate

Prior to this commit, `AsyncRestTemplate` would log errors (including
simple 404s) with WARN level. Such errors are quite common and should
not clutter logs.

This commit aligns the logging strategy with RestTemplate, using the
DEBUG level for such cases.

Fixes gh-28049
This commit is contained in:
Brian Clozel
2022-02-28 16:37:07 +01:00
parent 7e2106b850
commit 6f41180cc5

View File

@@ -559,9 +559,9 @@ public class AsyncRestTemplate extends org.springframework.http.client.support.I
}
private void handleResponseError(HttpMethod method, URI url, ClientHttpResponse response) throws IOException {
if (logger.isWarnEnabled()) {
if (logger.isDebugEnabled()) {
try {
logger.warn("Async " + method.name() + " request for \"" + url + "\" resulted in " +
logger.debug("Async " + method.name() + " request for \"" + url + "\" resulted in " +
response.getRawStatusCode() + " (" + response.getStatusText() + "); invoking error handler");
}
catch (IOException ex) {