geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r468824 - /geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/SocketAppenderImpl.java
Date Sun, 29 Oct 2006 02:45:07 GMT
Author: jdillon
Date: Sat Oct 28 19:45:07 2006
New Revision: 468824

URL: http://svn.apache.org/viewvc?view=rev&rev=468824
Log:
Attach a UUID to the MDC too, to allow logging from the same host to be uniquely identified

Modified:
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/SocketAppenderImpl.java

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/SocketAppenderImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/SocketAppenderImpl.java?view=diff&rev=468824&r1=468823&r2=468824
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/SocketAppenderImpl.java
(original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/SocketAppenderImpl.java
Sat Oct 28 19:45:07 2006
@@ -21,20 +21,22 @@
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.UUID;
 
 import org.apache.log4j.net.SocketAppender;
 import org.apache.log4j.spi.LoggingEvent;
 import org.apache.log4j.MDC;
 
 /**
- * Custom socket appender which attaches <tt>hostname</tt> and <tt>hostaddr</tt>
to
- * the {@link MDC}.
+ * Custom socket appender which attaches <tt>uuid</tt>, <tt>hostname</tt>
and <tt>hostaddr</tt> to the {@link MDC}.
  *
  * @version $Rev$ $Date$
  */
 public class SocketAppenderImpl
     extends SocketAppender
 {
+    private static final UUID uuid = UUID.randomUUID();
+
     public void append(final LoggingEvent event) {
         if (event == null) {
             return;
@@ -48,6 +50,7 @@
             throw new RuntimeException("Failed to lookup localhost", e);
         }
 
+        MDC.put("uuid", uuid);
         MDC.put("hostname", localHost.getHostName());
         MDC.put("hostaddr", localHost.getHostAddress());
 



Mime
View raw message