[logback-dev] svn commit: r2191 - in logback/trunk/logback-classic/src: main/java/ch/qos/logback/classic/spi test/java/ch/qos/logback/classic/corpus

noreply.ceki at qos.ch noreply.ceki at qos.ch
Fri Mar 6 19:27:06 CET 2009


Author: ceki
Date: Fri Mar  6 19:27:06 2009
New Revision: 2191

Modified:
   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

Log:
minor changes

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 19:27:06 2009
@@ -93,14 +93,18 @@
     }
   }
   
+  static public void printSTEP(StringBuilder sb, StackTraceElementProxy step) {
+    sb.append(step.toString());
+    appendPackagingData(sb, step);
+  }
+  
   static public void printSTEPArray(StringBuilder sb, IThrowableProxy tp) {
     StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
     int commonFrames = tp.getCommonFrames();
 
     for (int i = 0; i < stepArray.length - commonFrames; i++) {
       StackTraceElementProxy step = stepArray[i];
-      sb.append(step.toString());
-      appendPackagingData(sb, step);
+      printSTEP(sb, step);
       sb.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 19:27:06 2009
@@ -29,19 +29,25 @@
  * 
  * <p>if you wish to dump the events into a file, say "/corpus.log" :
  * 
- * <p>
- * <code>Corpus.dump(eventArray, "/corpus.log");
+ * <p> <code>Corpus.dump(eventArray, "/corpus.log");
  * 
  * <p>For the model behind the corpus, refer to {@link CorpusModel}.
  * 
  * @author Ceki G&uuml;lc&uuml;
- * 
+ *
  */
 public class Corpus {
 
   static public final int STANDARD_CORPUS_SIZE = 50 * 1000;
   private static final int STANDARD_SEED = 34780;
 
+  static List<String> getStandatdCorpusWordList() throws IOException {
+    ClassLoader classLoader = Corpus.class.getClassLoader();
+    URL originOfSpeciesURL = classLoader
+        .getResource("corpus/origin_of_species.txt");
+    return TextFileUtil.toWords(originOfSpeciesURL);
+  }
+
   /**
    * Make a standard corpus. The standard corpus has
    * {@link #STANDARD_CORPUS_SIZE} elements.
@@ -50,31 +56,28 @@
    * @throws IOException
    */
   static public ILoggingEvent[] makeStandardCorpus() throws IOException {
-    ClassLoader classLoader = Corpus.class.getClassLoader();
-    URL originOfSpeciesURL = classLoader
-        .getResource("corpus/origin_of_species.txt");
-    List<String> worldList = TextFileUtil.toWords(originOfSpeciesURL);
+    List<String> worldList = getStandatdCorpusWordList();
     CorpusModel corpusMaker = new CorpusModel(STANDARD_SEED, worldList);
     return make(corpusMaker, STANDARD_CORPUS_SIZE);
   }
 
-  static public ILoggingEvent[] make(CorpusModel corpusMaker, int n) {
-    LoggerContextVO lcVO = corpusMaker.getRandomlyNamedLoggerContextVO();
+  static public ILoggingEvent[] make(CorpusModel corpusModel, int n) {
+    LoggerContextVO lcVO = corpusModel.getRandomlyNamedLoggerContextVO();
     PubLoggingEventVO[] plevoArray = new PubLoggingEventVO[n];
     for (int i = 0; i < n; i++) {
       PubLoggingEventVO e = new PubLoggingEventVO();
       plevoArray[i] = e;
       e.loggerContextVO = lcVO;
-      e.timeStamp = corpusMaker.getRandomTimeStamp();
+      e.timeStamp = corpusModel.getRandomTimeStamp();
 
-      LogStatement logStatement = corpusMaker.getRandomLogStatementFromPool();
+      LogStatement logStatement = corpusModel.getRandomLogStatementFromPool();
       e.loggerName = logStatement.loggerName;
       e.level = logStatement.level;
       e.message = logStatement.mat.message;
-      e.argumentArray = corpusMaker
+      e.argumentArray = corpusModel
           .getRandomArgumentArray(logStatement.mat.numberOfArguments);
       e.throwableProxy = logStatement.throwableProxy;
-      e.threadName = corpusMaker.getRandomThreadNameFromPool();
+      e.threadName = corpusModel.getRandomThreadNameFromPool();
     }
     return plevoArray;
   }


More information about the logback-dev mailing list