logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r822081 - /logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java
Date Mon, 05 Oct 2009 23:09:33 GMT
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message