public class AsyncLogTarget extends AbstractWrappingTarget implements java.lang.Runnable
LogTarget mySlowTarget = ...;
AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
Thread thread = new Thread( asyncTarget );
thread.setPriority( Thread.MIN_PRIORITY );
thread.start();
logger.setLogTargets( new LogTarget[] { asyncTarget } );
| Modifier and Type | Field and Description |
|---|---|
private java.util.LinkedList |
m_list |
private int |
m_queueSize |
| Constructor and Description |
|---|
AsyncLogTarget(LogTarget logTarget)
Creation of a new async log target.
|
AsyncLogTarget(LogTarget logTarget,
boolean closeTarget)
Creation of a new async log target.
|
AsyncLogTarget(LogTarget logTarget,
int queueSize)
Creation of a new async log target.
|
AsyncLogTarget(LogTarget logTarget,
int queueSize,
boolean closeTarget)
Creation of a new async log target.
|
| Modifier and Type | Method and Description |
|---|---|
void |
doProcessEvent(LogEvent event)
Process a log event by adding it to queue.
|
void |
run()
Thread startup.
|
void |
setErrorHandler(ErrorHandler errorHandler)
Provide component with ErrorHandler.
|
close, getLogTargetgetErrorHandler, isOpen, open, processEventprivate final java.util.LinkedList m_list
private final int m_queueSize
public AsyncLogTarget(LogTarget logTarget)
logTarget - the underlying targetpublic AsyncLogTarget(LogTarget logTarget, int queueSize)
logTarget - the underlying targetqueueSize - the queue sizepublic AsyncLogTarget(LogTarget logTarget, boolean closeTarget)
logTarget - the underlying targetcloseTarget - close the underlying target when this target is closed. This flag
has no effect unless the logTarget implements Closeable.public AsyncLogTarget(LogTarget logTarget, int queueSize, boolean closeTarget)
logTarget - the underlying targetqueueSize - the queue sizecloseTarget - close the underlying target when this target is closed. This flag
has no effect unless the logTarget implements Closeable.public void setErrorHandler(ErrorHandler errorHandler)
setErrorHandler in interface ErrorAwaresetErrorHandler in class AbstractTargeterrorHandler - the errorHandlerpublic void doProcessEvent(LogEvent event)
doProcessEvent in class AbstractTargetevent - the log eventpublic void run()
run in interface java.lang.Runnable