You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/07/04 08:19:25 UTC
[02/28] ignite git commit: IGNITE-5599 Added log throttling.
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 <ak...@apache.org>
Authored: Thu Jun 29 14:43:42 2017 +0700
Committer: Alexey Kuznetsov <ak...@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());