[logback-dev] svn commit: r2195 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic/log4j logback-classic/src/main/java/ch/qos/logback/classic/net logback-classic/src/main/java/ch/qos/logback/classic/pattern logback-classic/src/main/java/ch/qos/logback/classic/spi logback-classic/src/test/java/ch/qos/logback/classic/corpus logback-classic/src/test/java/ch/qos/logback/classic/html logback-core/src/main/java/ch/qos/logback/core logback-examples/src/main/java/chapter5

noreply.ceki at qos.ch noreply.ceki at qos.ch
Fri Mar 6 21:49:38 CET 2009


Author: ceki
Date: Fri Mar  6 21:49:37 2009
New Revision: 2195

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/corpus/Corpus.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/corpus/TextFileUtil.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
   logback/trunk/logback-examples/src/main/java/chapter5/   (props changed)

Log:
- StackElementProxy's toSting() method no longer prepends the TAB character
- code dependent on this behavior was adapted consequently

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java	Fri Mar  6 21:49:37 2009
@@ -17,6 +17,7 @@
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.classic.spi.IThrowableProxy;
 import ch.qos.logback.classic.spi.StackTraceElementProxy;
+import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.LayoutBase;
 import ch.qos.logback.core.helpers.Transform;
 
@@ -128,6 +129,7 @@
       StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
       buf.append("  <log4j:throwable><![CDATA[");
       for (StackTraceElementProxy step : stepArray) {
+        buf.append(CoreConstants.TAB);
         buf.append(step.toString());
         buf.append("\r\n");
       }

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java	Fri Mar  6 21:49:37 2009
@@ -17,6 +17,7 @@
 import ch.qos.logback.classic.spi.IThrowableProxy;
 import ch.qos.logback.classic.spi.StackTraceElementProxy;
 import ch.qos.logback.classic.util.LevelToSyslogSeverity;
+import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.Layout;
 import ch.qos.logback.core.net.SyslogAppenderBase;
 import ch.qos.logback.core.net.SyslogWriter;
@@ -80,7 +81,9 @@
       StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
       try {
         for (StackTraceElementProxy step : stepArray) {
-          sw.write(prefix + step.toString());
+          sw.write(prefix);
+          sw.write(CoreConstants.TAB);
+          sw.write(step.toString());
           sw.flush();
         }
       } catch (IOException e) {

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java	Fri Mar  6 21:49:37 2009
@@ -141,7 +141,7 @@
 
   void printThrowableProxy(StringBuilder buf, IThrowableProxy tp) {
     ThrowableProxyUtil.printFirstLine(buf, tp);
-
+    buf.append(CoreConstants.LINE_SEPARATOR);
     StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
     int commonFrames = tp.getCommonFrames();
 
@@ -156,6 +156,7 @@
 
     for (int i = 0; i < maxIndex; i++) {
       String string = stepArray[i].toString();
+      buf.append(CoreConstants.TAB);
       buf.append(string);
       extraData(buf, stepArray[i]); // allow other data to be added
       buf.append(CoreConstants.LINE_SEPARATOR);

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java	Fri Mar  6 21:49:37 2009
@@ -22,7 +22,7 @@
   
   public String getSTEAsString() {
     if (steAsString == null) {
-      steAsString = "\tat " + ste.toString();
+      steAsString = "at " + ste.toString();
     }
     return steAsString;
   }

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java	Fri Mar  6 21:49:37 2009
@@ -103,7 +103,7 @@
     StringBuilder builder = new StringBuilder();
     for (StackTraceElementProxy step : stackTraceElementProxyArray) {
       String string = step.toString();
-      builder.append(string);
+      builder.append(CoreConstants.TAB).append(string);
       ThrowableProxyUtil.appendPackagingData(builder, step);
       builder.append(CoreConstants.LINE_SEPARATOR);
     }

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java	Fri Mar  6 21:49:37 2009
@@ -71,6 +71,7 @@
 
     while (tp != null) {
       printFirstLine(sb, tp);
+      sb.append(CoreConstants.LINE_SEPARATOR);
       printSTEPArray(sb, tp);
       tp = tp.getCause();
     }
@@ -104,6 +105,7 @@
 
     for (int i = 0; i < stepArray.length - commonFrames; i++) {
       StackTraceElementProxy step = stepArray[i];
+      sb.append(CoreConstants.TAB);
       printSTEP(sb, step);
       sb.append(CoreConstants.LINE_SEPARATOR);
     }
@@ -121,6 +123,5 @@
       buf.append(CoreConstants.CAUSED_BY);
     }
     buf.append(tp.getClassName()).append(": ").append(tp.getMessage());
-    buf.append(CoreConstants.LINE_SEPARATOR);
   }
 }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/corpus/Corpus.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/corpus/Corpus.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/corpus/Corpus.java	Fri Mar  6 21:49:37 2009
@@ -41,7 +41,7 @@
   static public final int STANDARD_CORPUS_SIZE = 50 * 1000;
   private static final int STANDARD_SEED = 34780;
 
-  static List<String> getStandatdCorpusWordList() throws IOException {
+  static public List<String> getStandatdCorpusWordList() throws IOException {
     ClassLoader classLoader = Corpus.class.getClassLoader();
     URL originOfSpeciesURL = classLoader
         .getResource("corpus/origin_of_species.txt");

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/corpus/TextFileUtil.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/corpus/TextFileUtil.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/corpus/TextFileUtil.java	Fri Mar  6 21:49:37 2009
@@ -12,6 +12,8 @@
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -20,8 +22,10 @@
 
   
   public static List<String> toWords(URL url) throws IOException {
-    String filename = url.getFile();
-    return toWords(filename);
+    InputStream is = url.openStream();
+    InputStreamReader reader = new InputStreamReader(is);
+    BufferedReader br = new BufferedReader(reader);
+    return toWords(br);
   }
 
   public static List<String> toWords(String filename) throws IOException {

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java	Fri Mar  6 21:49:37 2009
@@ -115,7 +115,7 @@
     String[] result = buf.toString().split(CoreConstants.LINE_SEPARATOR);
     System.out.println(result[0]);
     assertEquals("test1: msg1", result[0]);
-    assertEquals(DefaultThrowableRenderer.TRACE_PREFIX + "\tat c1.m1(f1:1)", result[1]);
+    assertEquals(DefaultThrowableRenderer.TRACE_PREFIX + "at c1.m1(f1:1)", result[1]);
   }
 
   @Test

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java	Fri Mar  6 21:49:37 2009
@@ -80,4 +80,5 @@
   public static long REFERENCE_BIPS = 9000;
   static public final char DOT = '.';
 
+  static public final char TAB = '\t';
 }


More information about the logback-dev mailing list