diff --git a/spring-cloud-gcp-pubsub/src/main/java/com/google/cloud/spring/pubsub/integration/inbound/PubSubInboundChannelAdapter.java b/spring-cloud-gcp-pubsub/src/main/java/com/google/cloud/spring/pubsub/integration/inbound/PubSubInboundChannelAdapter.java index 14ad6ad288..21bb4990fb 100644 --- a/spring-cloud-gcp-pubsub/src/main/java/com/google/cloud/spring/pubsub/integration/inbound/PubSubInboundChannelAdapter.java +++ b/spring-cloud-gcp-pubsub/src/main/java/com/google/cloud/spring/pubsub/integration/inbound/PubSubInboundChannelAdapter.java @@ -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); } } diff --git a/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/integration/inbound/PubSubInboundChannelAdapterTests.java b/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/integration/inbound/PubSubInboundChannelAdapterTests.java index 05289026e6..925fc53ded 100644 --- a/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/integration/inbound/PubSubInboundChannelAdapterTests.java +++ b/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/integration/inbound/PubSubInboundChannelAdapterTests.java @@ -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