E - type of object to logpublic class AsyncAppenderBase<E> extends UnsynchronizedAppenderBase<E> implements AppenderAttachable<E>
This appender buffers events in a BlockingQueue. Worker thread created by this appender takes
events from the head of the queue, and dispatches them to the single appender attached to this appender.
Please refer to the logback manual for further information about this appender.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_QUEUE_SIZE
The default buffer size.
|
name, startedcontext| Constructor and Description |
|---|
AsyncAppenderBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAppender(Appender<E> newAppender)
Add an appender.
|
protected void |
append(E eventObject) |
void |
detachAndStopAllAppenders()
Detach and processPriorToRemoval all previously added appenders.
|
boolean |
detachAppender(Appender<E> eAppender)
Detach the appender passed as parameter from the list of appenders.
|
boolean |
detachAppender(String name)
Detach the appender with the name passed as parameter from the list of
appenders.
|
Appender<E> |
getAppender(String name)
Get an appender by name.
|
int |
getDiscardingThreshold() |
int |
getNumberOfElementsInQueue()
Returns the number of elements currently in the blocking queue.
|
int |
getQueueSize() |
int |
getRemainingCapacity()
The remaining capacity available in the blocking queue.
|
boolean |
isAttached(Appender<E> eAppender)
Returns
true if the specified appender is in list of
attached appenders, false otherwise. |
protected boolean |
isDiscardable(E eventObject)
Is the eventObject passed as parameter discardable? The base class's implementation of this method always returns
'false' but sub-classes may (and do) override this method.
|
Iterator<Appender<E>> |
iteratorForAppenders()
Get an iterator for appenders contained in the parent object.
|
protected void |
preprocess(E eventObject)
Pre-process the event prior to queueing.
|
void |
setDiscardingThreshold(int discardingThreshold) |
void |
setQueueSize(int queueSize) |
void |
start() |
void |
stop() |
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toStringaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContextpublic static final int DEFAULT_QUEUE_SIZE
protected boolean isDiscardable(E eventObject)
Note that only if the buffer is nearly full are events discarded. Otherwise, when the buffer is "not full" all events are logged.
eventObject - the log eventprotected void preprocess(E eventObject)
eventObject - the log eventpublic void start()
start in interface LifeCyclestart in class UnsynchronizedAppenderBase<E>public void stop()
stop in interface LifeCyclestop in class UnsynchronizedAppenderBase<E>protected void append(E eventObject)
append in class UnsynchronizedAppenderBase<E>public int getQueueSize()
public void setQueueSize(int queueSize)
public int getDiscardingThreshold()
public void setDiscardingThreshold(int discardingThreshold)
public int getNumberOfElementsInQueue()
public int getRemainingCapacity()
BlockingQueue.remainingCapacity()public void addAppender(Appender<E> newAppender)
AppenderAttachableaddAppender in interface AppenderAttachable<E>newAppender - the appender to addpublic Iterator<Appender<E>> iteratorForAppenders()
AppenderAttachableiteratorForAppenders in interface AppenderAttachable<E>public Appender<E> getAppender(String name)
AppenderAttachablegetAppender in interface AppenderAttachable<E>name - name of appender to fetchpublic boolean isAttached(Appender<E> eAppender)
AppenderAttachabletrue if the specified appender is in list of
attached appenders, false otherwise.isAttached in interface AppenderAttachable<E>eAppender - the appender to checkpublic void detachAndStopAllAppenders()
AppenderAttachabledetachAndStopAllAppenders in interface AppenderAttachable<E>public boolean detachAppender(Appender<E> eAppender)
AppenderAttachabledetachAppender in interface AppenderAttachable<E>eAppender - the appender to detachpublic boolean detachAppender(String name)
AppenderAttachabledetachAppender in interface AppenderAttachable<E>name - the name of the appender to detachCopyright © 2005–2014 QOS.ch. All rights reserved.