Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 0acff93

Browse files
committed
#113 Quieting down logging for an expected 503
1 parent d055cc8 commit 0acff93

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/com/marklogic/rest/util/MgmtResponseErrorHandler.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import org.slf4j.Logger;
66
import org.slf4j.LoggerFactory;
7+
import org.springframework.http.HttpStatus;
78
import org.springframework.http.client.ClientHttpResponse;
89
import org.springframework.web.client.DefaultResponseErrorHandler;
910
import org.springframework.web.client.HttpClientErrorException;
@@ -18,8 +19,14 @@ public void handleError(ClientHttpResponse response) throws IOException {
1819
try {
1920
super.handleError(response);
2021
} catch (HttpClientErrorException | HttpServerErrorException ex) {
21-
if (logger.isErrorEnabled()) {
22-
logger.error("Logging HTTP response body to assist with debugging: " + ex.getResponseBodyAsString());
22+
String message = "Logging HTTP response body to assist with debugging: " + ex.getResponseBodyAsString();
23+
if (HttpStatus.SERVICE_UNAVAILABLE.equals(ex.getStatusCode())) {
24+
if (logger.isDebugEnabled()) {
25+
logger.debug(message);
26+
}
27+
}
28+
else if (logger.isErrorEnabled()) {
29+
logger.error(message);
2330
}
2431
throw ex;
2532
}

0 commit comments

Comments
 (0)