Looking at the source code for class org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer inside of the callExecuteListener(Message message, long deliveryTag)
method, the following happens
executeListener(getChannel(), message);
is calledlogger.error("Failed to invoke listener", e);
I don't need the stack trace to pollute the log in situations of AmqpRejectAndDontRequeueException thrown because my Retry Policy has been Exhausted, however I do want the stack traces for other exceptions.
I dont see an easy mechanism to override this behavior. What options do I have besides turning off logging completely for DirectMessageListenerContainer or writting a slf4j filter? Am I overlooking something?
No, you don't miss anything. We recently added this there though:
if (causeChainHasImmediateAcknowledgeAmqpException(e)) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("User requested ack for failed delivery: " + deliveryTag);
}
handleAck(deliveryTag, channelLocallyTransacted);
}
So, I think we could improve the logic there to skip an AmqpRejectAndDontRequeueException
as well.
Feel free to raise a JIRA ticket on the matter. Also contribution is welcome!