geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r632236 - in /geronimo/gshell/trunk: gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
Date Fri, 29 Feb 2008 06:43:18 GMT
Author: jdillon
Date: Thu Feb 28 22:43:15 2008
New Revision: 632236

URL: http://svn.apache.org/viewvc?rev=632236&view=rev
Log:
(GSHELL-46) Add flag to show exception stacktraces (patch from J Warner, thx)

Modified:
    geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java

Modified: geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java?rev=632236&r1=632235&r2=632236&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
(original)
+++ geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
Thu Feb 28 22:43:15 2008
@@ -82,10 +82,12 @@
         System.setProperty("gshell.log.console.level", level);
     }
 
-    //
-    // TODO: Add flag to show exception traces
-    //       https://issues.apache.org/jira/browse/GSHELL-46
-    //
+    @Option(name="-e", aliases={"--exception"}, description="Enable exception stack traces")
+    private void setException(boolean flag) {
+    	if (flag) {
+    		System.setProperty("gshell.show.stacktrace","true");
+    	}
+    }
     
     @Option(name="-d", aliases={"--debug"}, description="Enable DEBUG logging output")
     private void setDebug(boolean flag) {

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java?rev=632236&r1=632235&r2=632236&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
Thu Feb 28 22:43:15 2008
@@ -257,11 +257,18 @@
         io.err.print(cause.getClass().getSimpleName());
         io.err.println(": @|bold,red " + cause.getMessage() + "|");
 
+        // Determine if the stack trace flag is set
+        String stackTraceProperty = System.getProperty("gshell.show.stacktrace");
+        boolean stackTraceFlag = false;
+        if (stackTraceProperty != null) {
+        	stackTraceFlag = stackTraceProperty.trim().equals("true");
+        }
+        
         if (io.isDebug()) {
             // If we have debug enabled then skip the fancy bits below, and log the full
error, don't decode shit
             log.debug(error.toString(), error);
         }
-        else if (io.isVerbose()) {
+        else if (io.isVerbose() || stackTraceFlag) {
             // Render a fancy ansi colored stack trace
             StackTraceElement[] trace = cause.getStackTrace();
             StringBuffer buff = new StringBuffer();



Mime
View raw message