How to log Kafka Producer Config on Startup

915 views Asked by At

I currently have an application with inbound and outbound of kafka, however upon launch I can see the Consumer config being logged as so:

INFO  [o.a.k.c.c.ConsumerConfig] - ConsumerConfig values: 
    allow.auto.create.topics = true
    auto.commit.interval.ms = 5000
    auto.offset.reset = latest

but am having issues displaying the ProducerConfig like so upon startup

INFO  [o.a.k.c.p.ProducerConfig] - ProducerConfig values: 
    acks = 1
    batch.size = 0

I have been able to log them as a string once the Producer Constructor is called however I would like to keep the same logging format as the ConsumerConfig

        log.info("Producer Config:" + kafkaProducerSettings.toString());

    RESULTS IN:

       Producer Config:SendProducer(akka.kafka.ProducerSettings(properties=(batch.size,0)

1

There are 1 answers

2
Matthias J. Sax On

Both Consumer and Producer log their config on startup automatically. There is no need to write code for it. -- Thus, I believe the issue is in your log4j setting?