Description
Expected Behavior
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.
Current Behavior
Currently if no reply is returned and is not required it will always produce a debug level log containing the full message.
Context
The line which logs the message is contained here:
https://github.com/spring-projects/spring-integration/blob/main/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java#L159
I would imagine that it should be similar to this line where we first check if logging is enabled before logging
https://github.com/spring-projects/spring-integration/blob/main/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java#L61
Our requirement for this is that in some cases a Splitter may not always produce an output (as the original payload it received contained a list that was empty). We have strict requirements regarding logging of the original message we received, no standard output should contain the original message and we've already made use of the loggingEnabled
field to avoid logging the message in most cases. A potential workaround is to have the handler return something and have a downstream handler discard the message, however this seems a bit unnecessary if there is already a capability to avoid logging in an expected operation.
I am happy to make the change if needed.