You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2023/01/18 10:39:01 UTC

[GitHub] [sling-org-apache-sling-testing-clients] joerghoh commented on a diff in pull request #42: SLING-11748 - Improve logging output of HTTP retries in testing clients

joerghoh commented on code in PR #42:
URL: https://github.com/apache/sling-org-apache-sling-testing-clients/pull/42#discussion_r1073366762


##########
src/main/java/org/apache/sling/testing/clients/util/ServerErrorRetryStrategy.java:
##########
@@ -48,14 +50,15 @@ public boolean retryRequest(final HttpResponse response, final int executionCoun
         boolean needsRetry = executionCount <= SystemPropertiesConfig.getHttpRetries() && responseRetryCondition(response, expectedStatus);
 
         if (SystemPropertiesConfig.isHttpLogRetries() && needsRetry && LOG.isWarnEnabled()) {
-            LOG.warn("Request retry needed due to service unavailable response");
-            LOG.warn("Response headers contained:");
-            Arrays.stream(response.getAllHeaders()).forEach(h -> LOG.warn("Header {}:{}", h.getName(), h.getValue()));
+            LOG.warn("Request retry condition met: [count={}/{}], [expected-codes={}], [retry-codes={}]",
+                    executionCount, SystemPropertiesConfig.getHttpRetries(), expectedStatus, SystemPropertiesConfig.getHttpRetriesErrorCodes());
+            LOG.warn("Request: {}", getRequestDetails(context));
+            LOG.warn("Response: {}", getResponseDetails(response));

Review Comment:
   Why do write out this information in 3 distinct log messages? I would prefer a single log message, which is then much easier to capture than 3 subsequent messages.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org