|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.log.output.AbstractTarget
org.apache.log.output.AbstractWrappingTarget
org.apache.log.output.AsyncLogTarget
public class AsyncLogTarget
An asynchronous LogTarget that sends entries on in another thread. It is the responsibility of the user of this class to start the thread etc.
LogTarget mySlowTarget = ...;
AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
Thread thread = new Thread( asyncTarget );
thread.setPriority( Thread.MIN_PRIORITY );
thread.start();
logger.setLogTargets( new LogTarget[] { asyncTarget } );
| Field Summary | |
|---|---|
private java.util.LinkedList |
m_list
|
private int |
m_queueSize
|
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class org.apache.log.output.AbstractWrappingTarget |
|---|
close, getLogTarget |
| Methods inherited from class org.apache.log.output.AbstractTarget |
|---|
getErrorHandler, isOpen, open, processEvent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final java.util.LinkedList m_list
private final int m_queueSize
| Constructor Detail |
|---|
public AsyncLogTarget(LogTarget logTarget)
logTarget - the underlying target
public AsyncLogTarget(LogTarget logTarget,
int queueSize)
logTarget - the underlying targetqueueSize - the queue size
public 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.| Method Detail |
|---|
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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||