Skip to content

Commit

Permalink
fix: Optimize logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cnzakii committed Apr 15, 2024
1 parent 611c8d6 commit 64f2822
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void put(List<ConnectRecord> sinkRecords) {
}
sendMessage(sinkRecord);
} catch (Exception e) {
log.error("Failed to sink message via HTTP. ", e);
log.error("Failed to sink message via HTTP. Exception: ", e);
}
}
}
Expand All @@ -120,14 +120,14 @@ private void sendMessage(ConnectRecord record) {
.putHeader("Content-Type", "application/json; charset=utf-8")
.sendJson(record, ar -> {
if (ar.succeeded()) {
log.info("[HttpSinkConnector] Successfully send message via HTTP. Record: timestamp={}, offset={}", record.getTimestamp(),
record.getPosition().getOffset());
if (ar.result().statusCode() != HttpResponseStatus.OK.code()) {
log.error("[HttpSinkConnector] Failed to send message via HTTP. Response: {}", ar.result());
} else {
log.info("[HttpSinkConnector] Successfully send message via HTTP. ");
log.error("[HttpSinkConnector] Unexpected response received. StatusCode: {}", ar.result().statusCode());
}
} else {
// This function is accessed only when an error occurs at the network level
log.error("[HttpSinkConnector] Failed to send message via HTTP. Exception: {}", ar.cause().getMessage());
// This branch is only entered if an error occurs at the network layer
log.error("[HttpSinkConnector] Failed to send message via HTTP. Exception: ", ar.cause());
}
});
}
Expand Down

0 comments on commit 64f2822

Please sign in to comment.