1

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)

Blawless
  • 1,229
  • 2
  • 16
  • 26

1 Answers1

0

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?

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137
  • what exactly needs to be modified in log4j? actually only certain consumer configs are visible at startup. for instance in application .yaml I have: `auto-offset-reset: earliest enable-auto-commit: false fetch-min-bytes: 131072 fetch-max-wait: 1000` but I can see for instance only: `max.partition.fetch.bytes = 1048576 tmax.poll.interval.ms = 300000 tmax.poll.records = 500` – szend Jun 07 '23 at 11:33
  • There should be a single log line, printing the whole config. `ConsumerConfig` extends `AbstractConfig` (cf https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java#L357-L371 that logs the config at INFO level. – Matthias J. Sax Jun 12 '23 at 17:01