|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.UnsynchronizedAppenderBase<E>
ch.qos.logback.core.AsyncAppenderBase<E>
E
- public class AsyncAppenderBase<E>
This appender and derived classes, log events asynchronously. In order to avoid loss of logging events, this appender should be closed. It is the user's responsibility to close appenders, typically at the end of the application lifecycle.
This appender buffers events in aBlockingQueue
. 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.
Field Summary | |
---|---|
static int |
DEFAULT_QUEUE_SIZE
The default buffer size. |
Fields inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase |
---|
name, started |
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase |
---|
context |
Constructor Summary | |
---|---|
AsyncAppenderBase()
|
Method Summary | |
---|---|
void |
addAppender(Appender<E> newAppender)
Add an appender. |
protected void |
append(E eventObject)
|
void |
detachAndStopAllAppenders()
Detach and stop 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 attached, 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()
|
Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase |
---|
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString |
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase |
---|
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ch.qos.logback.core.spi.ContextAware |
---|
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext |
Field Detail |
---|
public static final int DEFAULT_QUEUE_SIZE
Constructor Detail |
---|
public AsyncAppenderBase()
Method Detail |
---|
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
-
protected void preprocess(E eventObject)
eventObject
- public void start()
start
in interface LifeCycle
start
in class UnsynchronizedAppenderBase<E>
public void stop()
stop
in interface LifeCycle
stop
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()
java.util.concurrent.BlockingQueue#remainingCapacity()}
public void addAppender(Appender<E> newAppender)
AppenderAttachable
addAppender
in interface AppenderAttachable<E>
public Iterator<Appender<E>> iteratorForAppenders()
AppenderAttachable
iteratorForAppenders
in interface AppenderAttachable<E>
public Appender<E> getAppender(String name)
AppenderAttachable
getAppender
in interface AppenderAttachable<E>
public boolean isAttached(Appender<E> eAppender)
AppenderAttachable
true
if the specified appender is in list of
attached attached, false
otherwise.
isAttached
in interface AppenderAttachable<E>
public void detachAndStopAllAppenders()
AppenderAttachable
detachAndStopAllAppenders
in interface AppenderAttachable<E>
public boolean detachAppender(Appender<E> eAppender)
AppenderAttachable
detachAppender
in interface AppenderAttachable<E>
public boolean detachAppender(String name)
AppenderAttachable
detachAppender
in interface AppenderAttachable<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |