i checked the librdkafka documentation and it says set_log_cb can be used to enable syslogging for librdkafka "Logs are logged through the log_cb which defaults to a stderr writer, there is also a builtin syslog writer you can configure with set_log_cb()." . I am not able to find how exactly to do it.
std::unique_ptr<RdKafka::Conf> conf(RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL));
std::unique_ptr<RdKafka::Conf> tconf(RdKafka::Conf::create(RdKafka::Conf::CONF_TOPIC));
conf->set("metadata.broker.list", brokers, errstr);
conf->set("bootstrap.servers", brokers, errstr);
// Set a termination signal which should make shutdown faster
char tmp[16];
snprintf(tmp, sizeof(tmp), "%i", SIGKILL);
conf->set("internal.termination.signal", tmp, errstr);
conf->set("topic.metadata.refresh.interval.ms","3000", errstr);
conf->set("default_topic_conf", tconf.get(), errstr);
conf->set("debug", "all", errstr);
Why I want the logging. If you see above config, i am using termination signal to stop the kafka threads, but some how it's not working and my process get's stuck in below function call and eventually gets killed.
if (thrd_join(thrd, NULL) != thrd_success)
rd_kafka_log(rk, LOG_ERR, "DESTROY",
"Failed to join main thread: %s "
"(was process forked?)",
rd_strerror(errno));
if I could enable syslogging i could see what is happening and debug it further. your help appreciated.
Aucun commentaire:
Enregistrer un commentaire