调用rd_kafka_last_error输出写kafka失败的原因

The last error is stored per-thread, if multiple rd_kafka_t handles are used in the same application thread the developer needs to make sure rd_kafka_last_error() is called immediately after a failed API call
This commit is contained in:
liuxueli
2021-05-18 11:24:26 +08:00
parent 51d977c1e8
commit 61d0ab46e2

View File

@@ -1308,7 +1308,9 @@ int tsg_send_log(struct tsg_log_instance_t *instance, struct TLD_handle_t *handl
MESA_handle_runtime_log(_instance->logger,
RLOG_LV_INFO,
"TSG_SEND_LOG",
"tsg_send_log to kafka is error, status: %d, topic: %s payload: %s",
"tsg_send_log to kafka is error of %s(%s), status: %d, topic: %s payload: %s",
rd_kafka_err2name(rd_kafka_last_error()),
rd_kafka_err2str(rd_kafka_last_error()),
status,
_instance->service2topic[log_msg->result[i].service_id].name,
payload