Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2D0DB200CDF for ; Tue, 4 Jul 2017 10:19:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2BFE5160BE1; Tue, 4 Jul 2017 08:19:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5D953160BFD for ; Tue, 4 Jul 2017 10:19:26 +0200 (CEST) Received: (qmail 69684 invoked by uid 500); 4 Jul 2017 08:19:25 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 69460 invoked by uid 99); 4 Jul 2017 08:19:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2017 08:19:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9249EE0E1E; Tue, 4 Jul 2017 08:19:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Tue, 04 Jul 2017 08:19:25 -0000 Message-Id: <8154b75ea8414db89409feadce4d7e42@git.apache.org> In-Reply-To: <555e0ba2261743cebbda6ee9d5c03c0b@git.apache.org> References: <555e0ba2261743cebbda6ee9d5c03c0b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/28] ignite git commit: IGNITE-5599 Added log throttling. archived-at: Tue, 04 Jul 2017 08:19:27 -0000 IGNITE-5599 Added log throttling. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/459dc9e4 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/459dc9e4 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/459dc9e4 Branch: refs/heads/ignite-2.1.2-exchange Commit: 459dc9e455ca23968210a50ebe87d312846cc48b Parents: 1ced55b Author: Alexey Kuznetsov Authored: Thu Jun 29 14:43:42 2017 +0700 Committer: Alexey Kuznetsov Committed: Thu Jun 29 14:43:42 2017 +0700 ---------------------------------------------------------------------- .../ignite/console/agent/rest/RestExecutor.java | 24 +++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/459dc9e4/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java ---------------------------------------------------------------------- diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java index 52d37c4..3936374 100644 --- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java +++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java @@ -32,9 +32,13 @@ import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; -import org.apache.ignite.console.demo.*; +import org.apache.ignite.IgniteLogger; +import org.apache.ignite.console.demo.AgentClusterDemo; import org.apache.ignite.internal.processors.rest.protocols.http.jetty.GridJettyObjectMapper; -import org.apache.log4j.Logger; +import org.apache.ignite.internal.util.typedef.internal.LT; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.logger.slf4j.Slf4jLogger; +import org.slf4j.LoggerFactory; import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS_AUTH_FAILED; import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS_FAILED; @@ -45,7 +49,7 @@ import static org.apache.ignite.internal.processors.rest.GridRestResponse.STATUS */ public class RestExecutor { /** */ - private static final Logger log = Logger.getLogger(RestExecutor.class); + private static final IgniteLogger log = new Slf4jLogger(LoggerFactory.getLogger(RestExecutor.class)); /** JSON object mapper. */ private static final ObjectMapper mapper = new GridJettyObjectMapper(); @@ -166,12 +170,15 @@ public class RestExecutor { } if (resp.code() == 401) - return RestResult.fail(STATUS_AUTH_FAILED, "Failed to authenticate in grid. Please check agent\'s login and password or node port."); + return RestResult.fail(STATUS_AUTH_FAILED, "Failed to authenticate in grid. " + + "Please check agent\'s login and password or node port."); return RestResult.fail(STATUS_FAILED, "Failed connect to node and execute REST command."); } - catch (ConnectException ignore) { - log.warn("Please ensure that nodes have ignite-rest-http module in classpath (was copied from libs/optional to libs folder)."); + catch (ConnectException ignored) { + LT.warn(log, "Failed connect to node and execute REST command. " + + "Please ensure that nodes have [ignite-rest-http] module in classpath " + + "(was copied from libs/optional to libs folder)."); throw new ConnectException("Failed connect to node and execute REST command [url=" + urlBuilder + "]"); } @@ -187,14 +194,15 @@ public class RestExecutor { */ public RestResult execute(boolean demo, String path, Map params, String mtd, Map headers, String body) { - log.debug("Start execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) + + if (log.isDebugEnabled()) + log.debug("Start execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) + ", parameters=" + params + "]"); try { return sendRequest(demo, path, params, mtd, headers, body); } catch (Exception e) { - log.info("Failed to execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) + + U.error(log, "Failed to execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) + ", parameters=" + params + "]", e); return RestResult.fail(404, e.getMessage());