diff options
author | Martin Ritchie <ritchiem@apache.org> | 2010-05-18 14:44:20 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2010-05-18 14:44:20 +0000 |
commit | 6768b7db27e89ee454693849cea6883aef48f941 (patch) | |
tree | 350f96e05d755d103564fc32718439bbbb5837b3 | |
parent | 572338d0d96269b2db560205a668dc4f8ab37f4d (diff) | |
download | qpid-python-6768b7db27e89ee454693849cea6883aef48f941.tar.gz |
QPID-2584 : Add Logging Actor to HouseKeepingTasks
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@945682 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java index 1f4dd56eb1..45d4be9340 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java @@ -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 implements Runnable 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 implements Runnable // 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); } } |