confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

Property "log_cb" must be set through dedicated .._set_..() function

Open mtrienis opened this issue 3 years ago • 0 comments

Description

I'm trying to redirect stdout logs to a proper logger and as far as I can tell, configuring log_cb is the proper configuration option to make that happen. Unfortunately, I get an error:

Traceback (most recent call last):
  File "test_producer.py", line 9, in <module>
    {"bootstrap.servers": "test-kafka:9092", "log_cb": log_cb})
cimpl.KafkaException: KafkaError{code=_INVALID_ARG,val=-186,str="Property "log_cb" must be set through dedicated .._set_..() function"}

How to reproduce

import confluent_kafka
from confluent_kafka import Producer


print("libversion", confluent_kafka.libversion())
print("version", confluent_kafka.version())


def log_cb(*args, **kwargs):
    pass


producer = Producer(
    {"bootstrap.servers": "test-kafka:9092", "log_cb": log_cb})
libversion ('1.9.0', 17367295)
version ('1.9.0', 17367040)
Traceback (most recent call last):
  File "test_producer.py", line 14, in <module>
    {"bootstrap.servers": "test-kafka:9092", "log_cb": log_cb})
cimpl.KafkaException: KafkaError{code=_INVALID_ARG,val=-186,str="Property "log_cb" must be set through dedicated .._set_..() function"}

Checklist

Please provide the following information:

  • [x] confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()):
  • [x] Apache Kafka broker version: NA
  • [x] Client configuration:
  • [x] Operating system: Debian GNU/Linux 9 (stretch)
  • [ ] Provide client logs (with 'debug': '..' as necessary)
  • [x] Provide broker log excerpts
  • [ ] Critical issue

mtrienis avatar Jun 28 '22 17:06 mtrienis