Author: sdeboy
Date: Mon Oct  5 23:09:32 2009
New Revision: 822081

URL: http://svn.apache.org/viewvc?rev=822081&view=rev
Log:
For a non-matching event when appendNonMatches=true, use the timestamp of the 
last matching event, to try to maintain time-based ordering even though we were 
unable to parse the event

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

Modified: 
logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java
URL: 
http://svn.apache.org/viewvc/logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java?rev=822081&r1=822080&r2=822081&view=diff
==============================================================================
--- 
logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java
 (original)
+++ 
logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java
 Mon Oct  5 23:09:32 2009
@@ -497,6 +497,8 @@
                 //appended as multiple lines on the same event..
                 //choice is to have each non-matching line show up as its own 
line, or append them all to a previous event
                 if (appendNonMatches) {
+                    //hold on to the previous time, so we can do our best to 
preserve time-based ordering if the event is a non-match
+                    String lastTime = (String)currentMap.get(TIMESTAMP);
                     //build an event from the previous match (held in current 
map)
                     if (currentMap.size() > 0) {
                         LoggingEvent event = buildEvent();
@@ -506,6 +508,9 @@
                             }
                         }
                     }
+                    if (lastTime != null) {
+                        currentMap.put(TIMESTAMP, lastTime);
+                    }
                     currentMap.put(MESSAGE, line);
                 } else {
                     additionalLines.add(line);



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to