You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ja...@apache.org on 2015/03/03 21:34:15 UTC

[2/3] karaf git commit: KARAF-3583 - Add option to configure log level in the client script

KARAF-3583 - Add option to configure log level in the client script


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

Branch: refs/heads/karaf-3.0.x
Commit: c92a530d5a306ee8f8a26202efbfa652c2221db9
Parents: 333f7b2
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Tue Mar 3 17:00:59 2015 -0330
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Tue Mar 3 17:01:31 2015 -0330

----------------------------------------------------------------------
 .../java/org/apache/karaf/client/ClientConfig.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/c92a530d/client/src/main/java/org/apache/karaf/client/ClientConfig.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/ClientConfig.java b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
index a409a07..ab08a72 100644
--- a/client/src/main/java/org/apache/karaf/client/ClientConfig.java
+++ b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
@@ -89,6 +89,20 @@ public class ClientConfig {
                     }
                 } else if (args[i].equals("-v")) {
                     level++;
+                } else if (args[i].equals("-l")) {
+                    if (args.length <= ++i) {
+                        System.err.println("miss the log level");
+                        System.exit(1);
+                    } else {
+                        int levelValue = Integer.parseInt(args[i]);
+                        if (levelValue < 0 || levelValue > 4) {
+                            System.err.println("log level can only be 0, 1, 2, 3, or 4");
+                            System.exit(1);
+                        } else {
+                            level = levelValue;
+                        }
+                    }
+
                 } else if (args[i].equals("-r")) {
                     if (args.length <= ++i) {
                         System.err.println("miss the attempts");
@@ -153,6 +167,7 @@ public class ClientConfig {
         System.out.println("  -u [user]     specify the user name");
         System.out.println("  --help        shows this help message");
         System.out.println("  -v            raise verbosity");
+        System.out.println("  -l            set client logging level. Set to 0 for ERROR logging and up to 4 for TRACE.");
         System.out.println("  -r [attempts] retry connection establishment (up to attempts times)");
         System.out.println("  -d [delay]    intra-retry delay (defaults to 2 seconds)");
         System.out.println("  -b            batch mode, specify multiple commands via standard input");