GH-3008: Fix SimpleMLC.logConsumerException for warn

Fixes: #3008
Issue link: https://github.com/spring-projects/spring-amqp/issues/3008

The real problem  in consumer (e.g. `ClassCastException` mentioned in the issue)
might be lost if DEBUG logging level is not enabled

* Fix the first condition in the `SimpleMessageListenerContainer.logConsumerException()`
to use  `logger.warn()` as it was before https://github.com/spring-projects/spring-amqp/issues/2278 fix

(cherry picked from commit b55010f742)
This commit is contained in:
Artem Bilan
2025-03-10 12:17:53 -04:00
committed by Spring Builds
parent 6afe7253d1
commit 88c04bb557

View File

@@ -1576,7 +1576,9 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
private void logConsumerException(Throwable t) {
if (logger.isDebugEnabled()
|| !(t instanceof AmqpConnectException || t instanceof ConsumerCancelledException)) {
logger.debug(
// It has to be WARN independently of condition.
// The meaning is: log WARN for all exception when DEBUG enabled, or all others, but mentioned
logger.warn(
"Consumer raised exception, processing can restart if the connection factory supports it",
t);
}