You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by sd...@apache.org on 2009/09/28 02:13:06 UTC

svn commit: r819428 - in /logging/log4j: companions/receivers/trunk/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java trunk/tests/build.xml

Author: sdeboy
Date: Mon Sep 28 00:13:06 2009
New Revision: 819428

URL: http://svn.apache.org/viewvc?rev=819428&view=rev
Log:
Update LogFilePatternReceivers
 - fix bugs in regular & VFS receiver's activateOptions & shutdown code to ensure the tailing thread is shut down when appropriate
 - For VFS receiver, release the file during the sleep interval, allowing the file to be deleted/renamed during tailing if necessary

Removed some tests from the set ran by the log4j ant script due to the fact that they always fail.

Also, had to run skip tests for zeroconf.
jmDns has an updated (and now incompatible) api, that should be changed that at some point.

It's also odd we have a couple of duplicate source files in extras (UtilLoggingLevel can be found in receivers, UnrecognizedElementHandler is in core log4j)

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

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=819428&r1=819427&r2=819428&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 Sep 28 00:13:06 2009
@@ -521,7 +521,6 @@
             if (passesExpression(event)) {
                 doPost(event);
             }
-            getLogger().debug("no further lines to process in " + fileURL);
         }
     }
 
@@ -588,6 +587,10 @@
 	  this.path = path;
   }
 
+  public String getPath() {
+      return path;
+  }
+
     /**
    * Build the regular expression needed to parse log entries
    *
@@ -857,6 +860,8 @@
    * Close the reader.
    */
   public void shutdown() {
+    getLogger().info(getPath() + " shutdown");
+    active = false;
     try {
       if (reader != null) {
         reader.close();
@@ -871,6 +876,8 @@
    * Read and process the log file.
    */
   public void activateOptions() {
+    getLogger().info("activateOptions");
+    active = true;
 	Runnable runnable = new Runnable() {
 	  public void run() {
         initialize();
@@ -894,13 +901,14 @@
                 BufferedReader bufferedReader = new BufferedReader(reader);
                 createPattern();
                 do {
-                    getLogger().debug("tailing file: " + tailing);
                     process(bufferedReader);
                     try {
                         synchronized (this) {
                             wait(waitMillis);
                         }
-                    } catch (InterruptedException ie) {
+                    } catch (InterruptedException ie) {}
+                    if (tailing) {
+                      getLogger().debug("tailing file");
                     }
                 } while (tailing);
 
@@ -908,7 +916,7 @@
                 //io exception - probably shut down
                 getLogger().info("stream closed");
             }
-            getLogger().debug("processing " + fileURL + " complete");
+            getLogger().debug("processing " + path + " complete");
             shutdown();
           }
         };
@@ -918,4 +926,4 @@
             new Thread(runnable, "LogFilePatternReceiver-"+getName()).start();
         }
     }
-}
\ No newline at end of file
+}

Modified: logging/log4j/trunk/tests/build.xml
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/tests/build.xml?rev=819428&r1=819427&r2=819428&view=diff
==============================================================================
--- logging/log4j/trunk/tests/build.xml (original)
+++ logging/log4j/trunk/tests/build.xml Mon Sep 28 00:13:06 2009
@@ -165,15 +165,13 @@
   <!-- unit tests. Regression tests compare output with a previously     -->
   <!-- created witness file.                                             -->
   <!-- ================================================================= -->  
-  <target name="regression" depends="Core, Minimum, Logger, DOM, CustomLevel, 
-                                     CustomLogger,  
-                                     HierarchyThreshold, DefaultInit, SocketServer, 
-                                     XMLLayout, AsyncAppender, 
-                                     OptionConverter, BoundedFIFO, 
-                                     CyclicBuffer, OR, 
+  <target name="regression" depends="Core, Minimum, Logger, DOM, CustomLevel,
+                                     CustomLogger,
+                                     HierarchyThreshold, DefaultInit, SocketServer,
+                                     XMLLayout, AsyncAppender,
+                                     OptionConverter, BoundedFIFO,
+                                     CyclicBuffer, OR,
                                      LevelMatchFilter, PatternParser, 
-                                     PatternLayout, RFA, ERFA, DRFA, 
-									 NTEventLogAppender, Syslog, Socket,
 									 ErrorHandler"/>
 
   <!-- ================================================================= -->



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