org.apache.log.output
public class AsyncLogTarget extends AbstractTarget 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 } );
| Constructor and Description |
|---|
AsyncLogTarget(LogTarget logTarget)
Creation of a new async log target.
|
AsyncLogTarget(LogTarget logTarget,
int queueSize)
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, error, getErrorHandler, isOpen, open, processEventpublic AsyncLogTarget(LogTarget logTarget)
logTarget - the underlying targetpublic AsyncLogTarget(LogTarget logTarget, int queueSize)
logTarget - the underlying targetqueueSize - the queue sizepublic 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