ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: IGNITE-843 Fixed agent logging.
Date Wed, 14 Oct 2015 05:10:12 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc1 4e039e64c -> f9cdac6b2


IGNITE-843 Fixed agent logging.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f9cdac6b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f9cdac6b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f9cdac6b

Branch: refs/heads/ignite-843-rc1
Commit: f9cdac6b2461c4a1186cffdb3904939218009fd0
Parents: 4e039e6
Author: Andrey <anovikov@gridgain.com>
Authored: Wed Oct 14 12:10:11 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Wed Oct 14 12:10:11 2015 +0700

----------------------------------------------------------------------
 modules/control-center-agent/pom.xml            |  2 +-
 .../apache/ignite/agent/AgentConfiguration.java | 11 ++++++----
 .../org/apache/ignite/agent/AgentLauncher.java  |  5 +++--
 .../handlers/DatabaseMetadataExtractor.java     | 21 ++++++++++----------
 .../ignite/agent/handlers/RestExecutor.java     |  8 ++++++++
 .../ignite/agent/remote/RemoteHandler.java      |  2 --
 .../agent/testdrive/AgentMetadataTestDrive.java |  3 ++-
 .../src/main/resources/logging.properties       |  3 +++
 8 files changed, 35 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f9cdac6b/modules/control-center-agent/pom.xml
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/pom.xml b/modules/control-center-agent/pom.xml
index 761cc63..af85efe 100644
--- a/modules/control-center-agent/pom.xml
+++ b/modules/control-center-agent/pom.xml
@@ -53,7 +53,7 @@
         <dependency>
             <groupId>com.google.code.gson</groupId>
             <artifactId>gson</artifactId>
-            <version>2.3</version>
+            <version>2.4</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9cdac6b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
index 8766b51..f13e183 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
@@ -35,6 +35,9 @@ public class AgentConfiguration {
     /** Default Ignite node HTTP port. */
     public static final int DFLT_NODE_PORT = 8080;
 
+    /** Default path to agent property file. */
+    public static final String DFLT_CFG_PATH = "default.properties";
+
     /** Default server URI. */
     private static final String DFLT_SERVER_URI = "wss://localhost:3001";
 
@@ -48,19 +51,19 @@ public class AgentConfiguration {
     /** */
     @Parameter(names = {"-s", "--server-uri"}, description = "URI for connect to Ignite Console
via web-socket protocol" +
         "           " +
-        "      Default value: wss://localhost:3001")
+        "      Default value: " + DFLT_SERVER_URI)
     private String srvUri;
 
     /** */
     @Parameter(names = {"-n", "--node-uri"}, description = "URI for connect to Ignite node
REST server" +
         "                        " +
-        "      Default value: http://localhost:8080")
+        "      Default value: " + DFLT_NODE_URI)
     private String nodeUri;
 
     /** */
     @Parameter(names = {"-c", "--config"}, description = "Path to agent property file" +
         "                                  " +
-        "      Default value: ./default.properties")
+        "      Default value: " + DFLT_CFG_PATH)
     private String cfgPath;
 
     /** */
@@ -130,7 +133,7 @@ public class AgentConfiguration {
      * @return Configuration path.
      */
     public String configPath() {
-        return cfgPath == null ? "./default.properties" : cfgPath;
+        return cfgPath == null ? DFLT_CFG_PATH : cfgPath;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9cdac6b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
index d7b0c30..abfc206 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
@@ -70,7 +70,8 @@ public class AgentLauncher {
             propCfg.load(new File(prop).toURI().toURL());
         }
         catch (IOException ignore) {
-            log.log(Level.WARNING, "Failed to load agent property file: '" + prop + "'",
ignore);
+            if (!AgentConfiguration.DFLT_CFG_PATH.equals(prop))
+                log.log(Level.WARNING, "Failed to load agent property file: '" + prop + "'",
ignore);
         }
 
         cfg.merge(propCfg);
@@ -112,7 +113,7 @@ public class AgentLauncher {
 
             System.out.print("Enter security token: ");
 
-            cfg.token(new String(System.console().readPassword()));
+            cfg.token(System.console().readLine().trim());
         }
 
         if (cfg.testDriveMetadata())

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9cdac6b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/DatabaseMetadataExtractor.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/DatabaseMetadataExtractor.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/DatabaseMetadataExtractor.java
index f40c77a..8e58329 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/DatabaseMetadataExtractor.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/DatabaseMetadataExtractor.java
@@ -89,12 +89,13 @@ public class DatabaseMetadataExtractor {
     @Remote
     public Collection<String> schemas(String jdbcDriverJarPath, String jdbcDriverCls,
String jdbcUrl,
         Properties jdbcInfo) throws SQLException {
-        log.log(Level.INFO, "Collecting database schemas...");
+        log.log(Level.FINE, "Start collecting database schemas [driver jar=" + jdbcDriverJarPath
+
+            ", driver class=" + jdbcDriverCls + ", url=" + jdbcUrl + "]");
 
         try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo))
{
             Collection<String> schemas = DbMetadataReader.getInstance().schemas(conn);
 
-            log.log(Level.INFO, "Collected schemas: " + schemas.size());
+            log.log(Level.FINE, "Collected schemas: " + schemas.size());
 
             return schemas;
         }
@@ -112,12 +113,12 @@ public class DatabaseMetadataExtractor {
     @Remote
     public Collection<DbTable> metadata(String jdbcDriverJarPath, String jdbcDriverCls,
String jdbcUrl,
         Properties jdbcInfo, List<String> schemas, boolean tblsOnly) throws SQLException
{
-        log.log(Level.INFO, "Collecting database metadata...");
+        log.log(Level.FINE, "Collecting database metadata...");
 
         try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo))
{
             Collection<DbTable> metadata = DbMetadataReader.getInstance().metadata(conn,
schemas, tblsOnly);
 
-            log.log(Level.INFO, "Collected metadata: " + metadata.size());
+            log.log(Level.FINE, "Collected metadata: " + metadata.size());
 
             return metadata;
         }
@@ -139,7 +140,7 @@ public class DatabaseMetadataExtractor {
     public List<JdbcDriver> availableDrivers() {
         String drvFolder = normalizePath(driversFolder);
 
-        log.log(Level.INFO, "Collecting JDBC drivers in folder: " + drvFolder);
+        log.log(Level.FINE, "Collecting JDBC drivers in folder: " + drvFolder);
 
         if (drvFolder == null) {
             log.log(Level.INFO, "JDBC drivers folder not specified, returning empty list");
@@ -170,7 +171,7 @@ public class DatabaseMetadataExtractor {
 
                         res.add(new JdbcDriver(fileName, jdbcDriverCls));
 
-                        log.log(Level.INFO, "Found: [driver=" + fileName + ", class=" + jdbcDriverCls
+ "]");
+                        log.log(Level.FINE, "Found: [driver=" + fileName + ", class=" + jdbcDriverCls
+ "]");
                     }
                 }
                 catch (IOException e) {
@@ -192,15 +193,15 @@ public class DatabaseMetadataExtractor {
         /** */
         private final String jdbcDriverJar;
         /** */
-        private final String jdbcDriverClass;
+        private final String jdbcDriverCls;
 
         /**
          * @param jdbcDriverJar File name of driver jar file.
-         * @param jdbcDriverClass Optional JDBC driver class.
+         * @param jdbcDriverCls Optional JDBC driver class.
          */
-        public JdbcDriver(String jdbcDriverJar, String jdbcDriverClass) {
+        public JdbcDriver(String jdbcDriverJar, String jdbcDriverCls) {
             this.jdbcDriverJar = jdbcDriverJar;
-            this.jdbcDriverClass = jdbcDriverClass;
+            this.jdbcDriverCls = jdbcDriverCls;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9cdac6b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/RestExecutor.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/RestExecutor.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/RestExecutor.java
index f745ba5..2cd8d61 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/RestExecutor.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/handlers/RestExecutor.java
@@ -23,6 +23,8 @@ import java.net.URISyntaxException;
 import java.nio.charset.Charset;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.apache.commons.codec.Charsets;
 import org.apache.http.Header;
 import org.apache.http.NameValuePair;
@@ -45,6 +47,9 @@ import static org.apache.ignite.agent.AgentConfiguration.DFLT_NODE_PORT;
  */
 public class RestExecutor {
     /** */
+    private static final Logger log = Logger.getLogger(RestExecutor.class.getName());
+
+    /** */
     private final AgentConfiguration cfg;
 
     /** */
@@ -82,6 +87,9 @@ public class RestExecutor {
     @Remote
     public RestResult executeRest(String path, Map<String, String> params, String mtd,
Map<String, String> headers,
         String body) throws IOException, URISyntaxException {
+        log.log(Level.FINE, "Start execute REST command [url=/" + path + ", method=" + mtd
+
+            ", parameters=" + params + "]");
+
         URIBuilder builder = new URIBuilder(cfg.nodeUri());
 
         if (builder.getPort() == -1)

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9cdac6b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/remote/RemoteHandler.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/remote/RemoteHandler.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/remote/RemoteHandler.java
index 3e6c9ec..d200190 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/remote/RemoteHandler.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/remote/RemoteHandler.java
@@ -94,8 +94,6 @@ public class RemoteHandler implements AutoCloseable {
      * @param req Request.
      */
     public void onMessage(JsonObject req) {
-        log.log(Level.FINE, "Message: " + req);
-
         JsonPrimitive reqIdJson = req.getAsJsonPrimitive("reqId");
 
         final Long reqId = reqIdJson == null ? null : reqIdJson.getAsLong();

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9cdac6b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentMetadataTestDrive.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentMetadataTestDrive.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentMetadataTestDrive.java
index 3e40dee..7e80250 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentMetadataTestDrive.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentMetadataTestDrive.java
@@ -66,10 +66,11 @@ public class AgentMetadataTestDrive {
 
                 File agentHome = AgentUtils.getAgentHome();
 
-                File sqlScript = new File((agentHome != null) ? new File(agentHome, "test-drive")
: new File("test-drive"),
+                File sqlScript = new File(agentHome != null ? new File(agentHome, "test-drive")
: new File("test-drive"),
                     "test-drive.sql");
 
                 RunScript.execute(conn, new FileReader(sqlScript));
+
                 log.log(Level.FINE, "TEST-DRIVE: Sample tables created.");
 
                 conn.close();

http://git-wip-us.apache.org/repos/asf/ignite/blob/f9cdac6b/modules/control-center-agent/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/resources/logging.properties b/modules/control-center-agent/src/main/resources/logging.properties
index 38b8ac1..eb80de5 100644
--- a/modules/control-center-agent/src/main/resources/logging.properties
+++ b/modules/control-center-agent/src/main/resources/logging.properties
@@ -17,6 +17,9 @@ handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
 
 .level=FINE
 
+org.apache.http.level=INFO
+org.apache.commons.beanutils.level=INFO
+
 java.util.logging.ConsoleHandler.formatter=org.apache.ignite.logger.java.JavaLoggerFormatter
 java.util.logging.ConsoleHandler.level=INFO
 


Mime
View raw message