logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject svn commit: r636954 - in /logging/log4j/trunk/src: changes/ main/java/org/apache/log4j/ main/java/org/apache/log4j/helpers/ main/java/org/apache/log4j/net/ main/java/org/apache/log4j/varia/
Date Fri, 14 Mar 2008 02:04:20 GMT
Author: psmith
Date: Thu Mar 13 19:04:13 2008
New Revision: 636954

URL: http://svn.apache.org/viewvc?rev=636954&view=rev
Log:
Bug 41156 Give log4j threads reasonable names.

Thread names are based on the class name that is the creator/related entity, and
where threads are based on Socket management, the port # being managed is included
in the name.  This follows a convention seen in many other packages (such as Tomcat)
to easily identify the resource the Thread is controlling.

I have renamed the AsyncAppender thread name that was already given an explicit name
to follow the above convention.

Modified:
    logging/log4j/trunk/src/changes/changes.xml
    logging/log4j/trunk/src/main/java/org/apache/log4j/AsyncAppender.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/FileWatchdog.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/net/SimpleSocketServer.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/net/SocketHubAppender.java
    logging/log4j/trunk/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java

Modified: logging/log4j/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=636954&r1=636953&r2=636954&view=diff
==============================================================================
--- logging/log4j/trunk/src/changes/changes.xml (original)
+++ logging/log4j/trunk/src/changes/changes.xml Thu Mar 13 19:04:13 2008
@@ -37,6 +37,7 @@
        <action action="fix" issue="43304">Make javamail, jmx, jms dependencies optional
in pom.xml.</action>
        <action action="add" issue="43874">SocketHubAppender should expose actual port
in use to extending classes.</action>
        <action action="add" issue="44551">SocketHubAppender in the 1.2.16 does not
support a scroll back buffer or application property</action>
+       <action action="add" issue="41156">Give log4j threads reasonable names/<action>
     </release>
   
     <release version="1.2.15" date="2007-08-24" description="SyslogAppender enhancements,
NTEventLogAppender and Maven build.">

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/AsyncAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/AsyncAppender.java?rev=636954&r1=636953&r2=636954&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/AsyncAppender.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/AsyncAppender.java Thu Mar 13 19:04:13
2008
@@ -19,12 +19,7 @@
 //               Thomas Tuft Muller <ttm@online.no>
 package org.apache.log4j;
 
-import org.apache.log4j.helpers.AppenderAttachableImpl;
-import org.apache.log4j.spi.AppenderAttachable;
-import org.apache.log4j.spi.LoggingEvent;
-
 import java.text.MessageFormat;
-
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -32,6 +27,10 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.log4j.helpers.AppenderAttachableImpl;
+import org.apache.log4j.spi.AppenderAttachable;
+import org.apache.log4j.spi.LoggingEvent;
+
 
 /**
  * The AsyncAppender lets users log events asynchronously.
@@ -119,7 +118,7 @@
 
     // set the dispatcher priority to lowest possible value
     //        dispatcher.setPriority(Thread.MIN_PRIORITY);
-    dispatcher.setName("Dispatcher-" + dispatcher.getName());
+    dispatcher.setName("AsyncAppender-Dispatcher-" + dispatcher.getName());
     dispatcher.start();
   }
 

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/FileWatchdog.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/FileWatchdog.java?rev=636954&r1=636953&r2=636954&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/FileWatchdog.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/FileWatchdog.java Thu Mar 13
19:04:13 2008
@@ -20,7 +20,6 @@
 package org.apache.log4j.helpers;
 
 import java.io.File;
-import org.apache.log4j.helpers.LogLog;
 
 /**
    Check every now and then that a certain file has not changed. If it
@@ -52,6 +51,7 @@
 
   protected
   FileWatchdog(String filename) {
+    super("FileWatchdog");
     this.filename = filename;
     file = new File(filename);
     setDaemon(true);

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/net/SimpleSocketServer.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/net/SimpleSocketServer.java?rev=636954&r1=636953&r2=636954&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/net/SimpleSocketServer.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/net/SimpleSocketServer.java Thu Mar
13 19:04:13 2008
@@ -17,11 +17,11 @@
 
 package org.apache.log4j.net;
 
-import java.net.Socket;
 import java.net.ServerSocket;
+import java.net.Socket;
 
-import org.apache.log4j.Logger;
 import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.log4j.xml.DOMConfigurator;
 
@@ -65,7 +65,7 @@
 	cat.info("Connected to client at " + socket.getInetAddress());
 	cat.info("Starting new socket node.");
 	new Thread(new SocketNode(socket,
-				  LogManager.getLoggerRepository())).start();
+				  LogManager.getLoggerRepository()),"SimpleSocketServer-" + port).start();
       }
     } catch(Exception e) {
       e.printStackTrace();

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/net/SocketHubAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/net/SocketHubAppender.java?rev=636954&r1=636953&r2=636954&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/net/SocketHubAppender.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/net/SocketHubAppender.java Thu Mar
13 19:04:13 2008
@@ -17,19 +17,19 @@
 
 package org.apache.log4j.net;
 
-import java.util.Vector;
-import java.net.Socket;
-import java.net.ServerSocket;
-import java.net.SocketException;
-import java.io.ObjectOutputStream;
 import java.io.IOException;
 import java.io.InterruptedIOException;
+import java.io.ObjectOutputStream;
 import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.util.Vector;
 
+import org.apache.log4j.AppenderSkeleton;
 import org.apache.log4j.helpers.CyclicBuffer;
 import org.apache.log4j.helpers.LogLog;
 import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.AppenderSkeleton;
 
 /**
   Sends {@link LoggingEvent} objects to a set of remote log servers,
@@ -350,6 +350,7 @@
       keepRunning = true;
       monitorThread = new Thread(this);
       monitorThread.setDaemon(true);
+      monitorThread.setName("SocketHubAppender-Monitor-" + port);
       monitorThread.start();
     }
     

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java?rev=636954&r1=636953&r2=636954&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java
(original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java
Thu Mar 13 19:04:13 2008
@@ -17,14 +17,14 @@
 
 package org.apache.log4j.varia;
 
-import org.apache.log4j.RollingFileAppender;
-import org.apache.log4j.helpers.LogLog;
-
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.net.ServerSocket;
 import java.net.Socket;
 
+import org.apache.log4j.RollingFileAppender;
+import org.apache.log4j.helpers.LogLog;
+
 /**
    This appender listens on a socket on the port specified by the
    <b>Port</b> property for a "RollOver" message. When such a message
@@ -122,7 +122,7 @@
 	while(true) {
 	  Socket socket = serverSocket.accept();
 	  LogLog.debug("Connected to client at " + socket.getInetAddress());
-	  new Thread(new HUPNode(socket, er)).start();
+	  new Thread(new HUPNode(socket, er), "ExternallyRolledFileAppender-HUP").start();
 	}
       }
       catch(Exception e) {



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