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:16 UTC

[3/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/067a7fc9
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/067a7fc9
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/067a7fc9

Branch: refs/heads/karaf-2.x
Commit: 067a7fc9639989f2ae557245c83189311ccd1dad
Parents: ae748e0
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Tue Mar 3 17:03:57 2015 -0330
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Tue Mar 3 17:04:02 2015 -0330

----------------------------------------------------------------------
 .../src/main/java/org/apache/karaf/client/Main.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/067a7fc9/client/src/main/java/org/apache/karaf/client/Main.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/Main.java b/client/src/main/java/org/apache/karaf/client/Main.java
index 354c988..6dc6b04 100644
--- a/client/src/main/java/org/apache/karaf/client/Main.java
+++ b/client/src/main/java/org/apache/karaf/client/Main.java
@@ -117,6 +117,19 @@ public class Main {
                     }
                 } 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");
@@ -163,6 +176,7 @@ public class Main {
                     System.out.println("                NB: this option is deprecated and will be removed in next Karaf version");
                     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");