felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r907001 - /felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/LogCommandImpl.java
Date Fri, 05 Feb 2010 16:58:51 GMT
Author: rickhall
Date: Fri Feb  5 16:58:50 2010
New Revision: 907001

URL: http://svn.apache.org/viewvc?rev=907001&view=rev
Log:
Modify "log" command to show stack trace. (FELIX-1987)

Modified:
    felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/LogCommandImpl.java

Modified: felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/LogCommandImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/LogCommandImpl.java?rev=907001&r1=907000&r2=907001&view=diff
==============================================================================
--- felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/LogCommandImpl.java (original)
+++ felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/LogCommandImpl.java Fri Feb
 5 16:58:50 2010
@@ -19,6 +19,8 @@
 package org.apache.felix.shell.impl;
 
 import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Enumeration;
@@ -77,16 +79,20 @@
         StringBuffer buffer = new StringBuffer();
         buffer.append(sdf.format(new Date(entry.getTime()))).append(" ");
         buffer.append(levelAsAString(entry.getLevel())).append(" - ");
-        buffer.append("Bundle:").append(entry.getBundle().getSymbolicName()).append(" ");
+        buffer.append("Bundle: ").append(entry.getBundle().getSymbolicName());
         if (entry.getServiceReference() != null)
         {
-            buffer.append(entry.getServiceReference().toString()).append(" ");
+            buffer.append(" - ");
+            buffer.append(entry.getServiceReference().toString());
         }
-        buffer.append("- ").append(entry.getMessage()).append(" - ");
+        buffer.append(" - ").append(entry.getMessage());
         if (entry.getException() != null)
         {
-            buffer.append(entry.getException().getClass().getName()).append(": ").append(
-                entry.getException().getMessage());
+            buffer.append(" - ");
+            StringWriter writer = new StringWriter();
+            PrintWriter  pw = new PrintWriter(writer);
+            entry.getException().printStackTrace(pw);
+            buffer.append(writer.toString());
         }
 
         out.println(buffer.toString());



Mime
View raw message