From commits-return-9017-archive-asf-public=cust-asf.ponee.io@kafka.apache.org Tue Feb 20 18:18:21 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 5500E180654 for ; Tue, 20 Feb 2018 18:18:21 +0100 (CET) Received: (qmail 94044 invoked by uid 500); 20 Feb 2018 17:18:20 -0000 Mailing-List: contact commits-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list commits@kafka.apache.org Received: (qmail 94035 invoked by uid 99); 20 Feb 2018 17:18:20 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Feb 2018 17:18:20 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id CE6A98247D; Tue, 20 Feb 2018 17:18:19 +0000 (UTC) Date: Tue, 20 Feb 2018 17:18:19 +0000 To: "commits@kafka.apache.org" Subject: [kafka] branch trunk updated: MINOR: Redirect response code in Connect's RestClient to logs instead of stdout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <151914709936.12242.1450569157408564213@gitbox.apache.org> From: damianguy@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: kafka X-Git-Refname: refs/heads/trunk X-Git-Reftype: branch X-Git-Oldrev: ac2536e77e43510cde6009146487a5f867bf9b3f X-Git-Newrev: b79e11bb511e259c8187d865761c3b448391603f X-Git-Rev: b79e11bb511e259c8187d865761c3b448391603f X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 stdout b79e11b is described below commit b79e11bb511e259c8187d865761c3b448391603f Author: Konstantine Karantasis 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 Reviewers: Randall Hauch , Damian Guy 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 b/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.method(method); req.accept("application/json"); req.agent("kafka-connect"); - req.content(new StringContentProvider(serializedBody, StandardCharsets.UTF_8), "application/json"); + if (serializedBody != null) { + req.content(new StringContentProvider(serializedBody, StandardCharsets.UTF_8), "application/json"); + } 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()), null); } else if (responseCode >= 400) { -- To stop receiving notification emails like this one, please contact damianguy@apache.org.