spring-projects / spring-kafka

Provides Familiar Spring Abstractions for Apache Kafka
https://projects.spring.io/spring-kafka
Apache License 2.0
2.17k stars 1.55k forks source link

Add the possibility to customize DeadLetterPublishingRecovererFactory logging #3424

Closed lm231290 closed 1 month ago

lm231290 commented 1 month ago

Expected Behavior

RetryTopicConfigurationSupport to allow customizing log behavior

Current Behavior

DeadLetterPublishingRecovererFactory.maybeLogListenerException is private and can't be customized

Context

I want to log only certain type of exceptions controlled by the services of the application. If the exception class is not our business exception, I'd like to log high-level info only with no details and the stack trace The matter is some exceptions can contain PHII which is not allowed to be logged. For instance, we use Confluent Kafka, and when it fails to deserialize, it adds the message payload in the exception As a workaround I tried to override DestinationTopicResolver, RetryTopicComponentFactory or log in the PartitionResolver. All the options have drawbacks such as limited input, or called more then once, or require massive factory customization