devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wk...@apache.org
Subject svn commit: r1720940 - /devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/Main.java
Date Sat, 19 Dec 2015 15:13:52 GMT
Author: wkeil
Date: Sat Dec 19 15:13:52 2015
New Revision: 1720940

URL: http://svn.apache.org/viewvc?rev=1720940&view=rev
Log:
DMAP-54: Improve Console example 
Deprecating, moving relevant functionality to Java Console
Task-Url: https://issues.apache.org/jira/browse/DMAP-54

Modified:
    devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/Main.java

Modified: devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/Main.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/Main.java?rev=1720940&r1=1720939&r2=1720940&view=diff
==============================================================================
--- devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/Main.java
(original)
+++ devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/Main.java
Sat Dec 19 15:13:52 2015
@@ -48,7 +48,8 @@ public class Main {
         String loaderPath = null;
         LoaderOption option = LoaderOption.UNINITIALIZED;
         String parameter = null;
-        boolean debug = true;
+        boolean debug = false;
+        Level debugLevel = Level.OFF;
 
         for (int i = 0; i < args.length; i++) {
             if (args[i].equals("-f")) {
@@ -63,14 +64,17 @@ public class Main {
                 }
             } else if (args[i].equals("-j")) {
                 option = LoaderOption.JAR;
-            } else if (args[i].equals("-d")) {
-                debug = false;
+            } else if (args[i].equals("-l")) {
+                debug = true;
+                if (args.length > (++i)) {
+                    debugLevel = Level.parse(args[i]);
+                }
             } else if (args[i].startsWith("-h") || args[i].startsWith("--h")) {
                 System.out.println("Usage: " + Main.class.getName() + " [OPTIONS] [FILE|STRING]\n");
                 System.out.println("  -f <path>            load DeviceMap resouces
from folder or \"default\"");
                 System.out.println("  -j                   load DeviceMap resouces from jar
file in classpath");
                 System.out.println("  -u <url>             load DeviceMap resouces
from URL or \"default\"");
-                System.out.println("  -d                   no debug logging");
+                System.out.println("  -l <level>           log level set to <level>");
                 System.out.println("  FILE                 text file of strings");
                 System.out.println("  STRING               test string");
 
@@ -83,11 +87,11 @@ public class Main {
         }
         
         if(debug) {
-            Logger.getLogger(DeviceMapClient.class.getName()).setLevel(Level.ALL);
-            Logger.getLogger(DDRLoader.class.getName()).setLevel(Level.ALL);
+            Logger.getLogger(DeviceMapClient.class.getName()).setLevel(debugLevel);
+            Logger.getLogger(DDRLoader.class.getName()).setLevel(debugLevel);
             for (Handler h : Logger.getLogger(DeviceMapClient.class.getName()).getParent().getHandlers())
{
                 if (h instanceof ConsoleHandler) {
-                  h.setLevel(Level.ALL);
+                  h.setLevel(debugLevel);
                 }
             }
         }



Mime
View raw message