logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r423735 - /logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java
Date Thu, 20 Jul 2006 03:14:46 GMT
Author: sdeboy
Date: Wed Jul 19 20:14:46 2006
New Revision: 423735

URL: http://svn.apache.org/viewvc?rev=423735&view=rev
Log:
Replace one or more spaces in logFormat with the [ ]+ regexp
(supports padding of fields -like LEVEL- in the log file)

Modified:
    logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java

Modified: logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java?rev=423735&r1=423734&r2=423735&view=diff
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java Wed Jul
19 20:14:46 2006
@@ -162,7 +162,8 @@
   private static final String PATTERN_WILDCARD = "*";
   private static final String DEFAULT_GROUP = "(" + REGEXP_DEFAULT_WILDCARD + ")";
   private static final String GREEDY_GROUP = "(" + REGEXP_GREEDY_WILDCARD + ")";
-
+  private static final String MULTIPLE_SPACES_REGEXP = "[ ]+";
+  
   private final String newLine = System.getProperty("line.separator");
 
   private final String[] emptyException = new String[] { "" };
@@ -590,6 +591,10 @@
     }
 
     newPattern = replaceMetaChars(newPattern);
+
+    //compress one or more spaces in the pattern into the [ ]+ regexp
+    //(supports padding of level in log files)
+    newPattern = util.substitute("s/" + MULTIPLE_SPACES_REGEXP +"/" + MULTIPLE_SPACES_REGEXP
+ "/g", newPattern);
     newPattern = replace(PATTERN_WILDCARD, REGEXP_DEFAULT_WILDCARD, newPattern);
 
     /*



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message