You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2010/05/18 16:44:20 UTC

svn commit: r945682 - /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java

Author: ritchiem
Date: Tue May 18 14:44:20 2010
New Revision: 945682

URL: http://svn.apache.org/viewvc?rev=945682&view=rev
Log:
QPID-2584 : Add Logging Actor to HouseKeepingTasks

Modified:
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java

Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java?rev=945682&r1=945681&r2=945682&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java Tue May 18 14:44:20 2010
@@ -21,6 +21,9 @@
 package org.apache.qpid.server.virtualhost;
 
 import org.apache.log4j.Logger;
+import org.apache.qpid.server.logging.RootMessageLogger;
+import org.apache.qpid.server.logging.actors.AbstractActor;
+import org.apache.qpid.server.logging.actors.CurrentActor;
 
 public abstract class HouseKeepingTask implements Runnable
 {
@@ -30,10 +33,12 @@ public abstract class HouseKeepingTask i
 
     private String _name;
 
+    private RootMessageLogger _rootLogger;
     public HouseKeepingTask(VirtualHost vhost)
     {
         _virtualhost = vhost;
         _name = _virtualhost.getName() + ":" + this.getClass().getSimpleName();
+        _rootLogger = CurrentActor.get().getRootMessageLogger();
     }
 
     final public void run()
@@ -41,13 +46,22 @@ public abstract class HouseKeepingTask i
         // Don't need to undo this as this is a thread pool thread so will
         // always go through here before we do any real work.
         Thread.currentThread().setName(_name);
+        CurrentActor.set(new AbstractActor(_rootLogger)
+        {
+            @Override
+            public String getLogMessage()
+            {
+                return _name;
+            }
+        });
+
         try
         {
             execute();
         }
         catch (Throwable e)
         {
-            _logger.warn(this.getClass().getSimpleName() + " throw exception: " + e);
+            _logger.warn(this.getClass().getSimpleName() + " throw exception: " + e, e);
         }
     }
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org