Browse Source

Include current exception in log message for failed retry attempt

Prior to this commit, we included the initial exception in the log
message for the initial invocation of a retryable operation; however,
we did not include the current exception in the log message for
subsequent attempts.

For consistency, we now include the current exception in log messages
for subsequent retry attempts as well.

Closes gh-35433
pull/35447/head
Sam Brannen 3 months ago
parent
commit
7b2730c271
  1. 2
      spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java

2
spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java

@ -178,7 +178,7 @@ public class RetryTemplate implements RetryOperations { @@ -178,7 +178,7 @@ public class RetryTemplate implements RetryOperations {
return result;
}
catch (Throwable currentException) {
logger.debug(() -> "Retry attempt for operation '%s' failed due to '%s'"
logger.debug(currentException, () -> "Retry attempt for operation '%s' failed due to '%s'"
.formatted(retryableName, currentException));
this.retryListener.onRetryFailure(this.retryPolicy, retryable, currentException);
exceptions.add(currentException);

Loading…
Cancel
Save