org.shiftone.jrat.util.log.target
Class ThreadLocalLogTarget
java.lang.Object
org.shiftone.jrat.util.log.target.ThreadLocalLogTarget
- All Implemented Interfaces:
- LogTarget
public class ThreadLocalLogTarget
- extends java.lang.Object
- implements LogTarget
This is a LogTarget that uses a delegate LogTarget that lives on the thread.
This makes it possible to run a command within a scope, and have the
activities of that scope to be logged to a different LogTarget - but only
during the duration of that command.
- Author:
- jeff@shiftone.org (Jeff Drost)
Method Summary |
void |
executeInScope(LogTarget newTarget,
java.lang.Runnable runnable)
|
boolean |
isLevelEnabled(java.lang.String topic,
int level)
|
void |
log(java.lang.String topic,
int level,
java.lang.Object message,
java.lang.Throwable throwable)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
threadLocal
public java.lang.ThreadLocal threadLocal
ThreadLocalLogTarget
public ThreadLocalLogTarget()
ThreadLocalLogTarget
public ThreadLocalLogTarget(LogTarget target)
isLevelEnabled
public boolean isLevelEnabled(java.lang.String topic,
int level)
- Specified by:
isLevelEnabled
in interface LogTarget
log
public void log(java.lang.String topic,
int level,
java.lang.Object message,
java.lang.Throwable throwable)
- Specified by:
log
in interface LogTarget
executeInScope
public void executeInScope(LogTarget newTarget,
java.lang.Runnable runnable)