mslissap
mslissap

Reputation: 453

Spring-Kafka ReplyingKafkaTemplate logs full details instead of metadata only when reply times out

I am using ReplyingKafkaTemplate to get a synchronous response. When this times out waiting on a response, the entire payload is logged instead of only the metadata, though I have set the option to only log metadata. I am using spring boot 2.6.2, spring-kafka 2.8.1.

What am I missing to get this to only log metadata?

I have tried setting the spring property in application.properties:

spring.kafka.listener.only-log-record-metadata=true

I have tried setting it directly on the beans:

repliesContainer.getContainerProperties().setOnlyLogRecordMetadata(true);

I have tried adding this Customizer class I found here: https://github.com/spring-projects/spring-kafka/issues/1659

@Component
public class Customizer {

    Customizer(AbstractKafkaListenerContainerFactory<?, ?, ?> factory) {
        factory.getContainerProperties().setOnlyLogRecordMetadata(true);
    }
}

Regardless of these attempts, the full payload is still being logged when the reply times out.

Upvotes: 1

Views: 634

Answers (1)

Gary Russell
Gary Russell

Reputation: 174729

ProducerRecords are logged directly by the template, not the container (which logs ConsumerRecords).

We don't currently have a utility for ProducerRecords.

I opened an issue https://github.com/spring-projects/spring-kafka/issues/2132

Upvotes: 2

Related Questions