Skip to content

Commit 7b2730c

Browse files
committed
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
1 parent d218b08 commit 7b2730c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public RetryListener getRetryListener() {
178178
return result;
179179
}
180180
catch (Throwable currentException) {
181-
logger.debug(() -> "Retry attempt for operation '%s' failed due to '%s'"
181+
logger.debug(currentException, () -> "Retry attempt for operation '%s' failed due to '%s'"
182182
.formatted(retryableName, currentException));
183183
this.retryListener.onRetryFailure(this.retryPolicy, retryable, currentException);
184184
exceptions.add(currentException);

0 commit comments

Comments
 (0)