From 1071c3c082ca7dca4f577f9aaa71ff20a20bb299 Mon Sep 17 00:00:00 2001 From: Mitchell <38743745+mitchmcd18@users.noreply.github.com> Date: Wed, 11 Dec 2024 04:02:21 +1300 Subject: [PATCH] GH-9705: AbstractReplyProducingMessageHandler: check for logging enabled Fixes: #9705 Issue link: https://github.com/spring-projects/spring-integration/issues/9705 Currently when any class that implements `AbstractReplyProducingMessageHandler` doesn't produce a reply it will log the message, even if no reply is required. The message should only be logged if `isLoggingEnabled()` returns true as a handler that doesn't require a reply may be a normal operation that is expected, and if we've set `loggingEnabled` to false it shouldn't log the message. * Prevent logging when no reply is provided for an `AbstractReplyProducingMessageHandler` if logging is disabled (cherry picked from commit 7fc104ac8bb73372d48f9dcd72271f32ae46ce77) --- .../handler/AbstractReplyProducingMessageHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java index 0bf1c9f91c..0af35ad0dc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java @@ -154,7 +154,7 @@ public abstract class AbstractReplyProducingMessageHandler extends AbstractMessa throw new ReplyRequiredException(message, "No reply produced by handler '" + getComponentName() + "', and its 'requiresReply' property is set to true."); } - else if (!isAsync()) { + else if (!isAsync() && isLoggingEnabled()) { logger.debug(LogMessage.format("handler '%s' produced no reply for request Message: %s", this, message)); } }