From 7b2730c271eaaddf3def5165653299d438b63b2b Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sat, 6 Sep 2025 16:16:38 +0200 Subject: [PATCH] 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 --- .../main/java/org/springframework/core/retry/RetryTemplate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java b/spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java index faa6b242cd5..74be5041832 100644 --- a/spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java +++ b/spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java @@ -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);