kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From damian...@apache.org
Subject [kafka] branch trunk updated: MINOR: Redirect response code in Connect's RestClient to logs instead of stdout
Date Tue, 20 Feb 2018 17:18:19 GMT
This is an automated email from the ASF dual-hosted git repository.

damianguy pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git

The following commit(s) were added to refs/heads/trunk by this push:
     new b79e11b  MINOR: Redirect response code in Connect's RestClient to logs instead of
b79e11b is described below

commit b79e11bb511e259c8187d865761c3b448391603f
Author: Konstantine Karantasis <konstantine@confluent.io>
AuthorDate: Tue Feb 20 17:15:31 2018 +0000

    MINOR: Redirect response code in Connect's RestClient to logs instead of stdout
    Sending the response code of an http request issued via `RestClient` in Connect to stdout
seems like a unconventional choice.
    This PR redirects the responds code with a message in the logs at DEBUG level (usually
the same level as the one that the caller of `RestClient.httpRequest` uses.
    This fix will also fix system tests that broke by outputting this response code to stdout.
    Author: Konstantine Karantasis <konstantine@confluent.io>
    Reviewers: Randall Hauch <rhauch@gmail.com>, Damian Guy <damian.guy@gmail.com>
    Closes #4591 from kkonstantine/MINOR-Redirect-response-code-in-Connect-RestClient-to-logs-instead-of-stdout
 .../main/java/org/apache/kafka/connect/runtime/rest/RestClient.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/RestClient.java
index d500ad2..15e8418 100644
--- a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/RestClient.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/RestClient.java
@@ -82,12 +82,14 @@ public class RestClient {
-            req.content(new StringContentProvider(serializedBody, StandardCharsets.UTF_8),
+            if (serializedBody != null) {
+                req.content(new StringContentProvider(serializedBody, StandardCharsets.UTF_8),
+            }
             ContentResponse res = req.send();
             int responseCode = res.getStatus();
-            System.out.println(responseCode);
+            log.debug("Request's response code: {}", responseCode);
             if (responseCode == HttpStatus.NO_CONTENT_204) {
                 return new HttpResponse<>(responseCode, convertHttpFieldsToMap(res.getHeaders()),
             } else if (responseCode >= 400) {

To stop receiving notification emails like this one, please contact

View raw message