summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2021-05-18 11:24:26 +0800
committerliuxueli <[email protected]>2021-05-18 11:24:26 +0800
commit61d0ab46e20bfd9d8b1179ab00c4a3157ed19a40 (patch)
treed2bdeafd2f55f744273c471921cdc3ea2e2b0070
parent51d977c1e8fb1e0f5e622974bd45cc7a4dcfec29 (diff)
调用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
-rw-r--r--src/tsg_send_log.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp
index c8a4ba2..bfdb01e 100644
--- a/src/tsg_send_log.cpp
+++ b/src/tsg_send_log.cpp
@@ -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