ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [28/50] ignite git commit: IGNITE-5599 Added log throttling.
Date Tue, 04 Jul 2017 10:02:34 GMT
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/master
Commit: 459dc9e455ca23968210a50ebe87d312846cc48b
Parents: 1ced55b
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Thu Jun 29 14:43:42 2017 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
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<String, Object> params,
         String mtd, Map<String, Object> 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());


Mime
View raw message