Skip to content

Commit

Permalink
feat: log stacktrace (#3418)
Browse files Browse the repository at this point in the history
* feat: log stacktrace

* use string writer

* reformat

* modify test

* log exception along the message
  • Loading branch information
JoeWang1127 authored Dec 16, 2024
1 parent 765975d commit cebcbed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ private void logWarning(
// so we explicitly log failure messages.
// See https://github.com/spring-projects/spring-framework/issues/25162 for more info.
if (re instanceof MessageDeliveryException messageDeliveryException) {
LOGGER.warn(messageDeliveryException.getFailedMessage());
LOGGER.warn(messageDeliveryException.getFailedMessage(), messageDeliveryException);
} else {
LOGGER.warn(re.getMessage());
LOGGER.warn(re.getMessage(), re);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ void testAckModeAuto_nacksWhenDownstreamProcessingFailsWhenContextShutdown(Captu
verify(mockAcknowledgeableMessage, times(0)).ack();

// original message handling exception
assertThat(capturedOutput).contains("failed; message nacked automatically").contains(EXCEPTION_MESSAGE);
assertThat(capturedOutput)
.contains("failed; message nacked automatically")
.contains(EXCEPTION_MESSAGE)
.contains("Caused by");
}

@Test
Expand Down

0 comments on commit cebcbed

Please sign in to comment.