Package ch.qos.logback.core
Class AppenderBase<E>
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.AppenderBase<E>
-
- All Implemented Interfaces:
Appender<E>
,ContextAware
,FilterAttachable<E>
,LifeCycle
- Direct Known Subclasses:
AbstractServerSocketAppender
,AbstractSocketAppender
,CountingConsoleAppender
,CyclicBufferAppender
,ListAppender
,NOPAppender
,SiftingAppenderBase
,SMTPAppenderBase
,SyslogAppenderBase
,TrivialLogbackAppender
public abstract class AppenderBase<E> extends ContextAwareBase implements Appender<E>
Sets a skeleton implementation for appenders.For more information about this appender, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#AppenderBase
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
ALLOWED_REPEATS
private int
exceptionCount
private FilterAttachableImpl<E>
fai
private boolean
guard
The guard prevents an appender from repeatedly calling its own doAppend method.protected java.lang.String
name
Appenders are named.protected boolean
started
private int
statusRepeatCount
-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description AppenderBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addFilter(Filter<E> newFilter)
Add a filter.protected abstract void
append(E eventObject)
void
clearAllFilters()
void
doAppend(E eventObject)
This is where an appender accomplishes its work.java.util.List<Filter<E>>
getCopyOfAttachedFiltersList()
Get a copy of all the filters contained within this FilterAttachable object.FilterReply
getFilterChainDecision(E event)
Loop through the filters in the chain.java.lang.String
getName()
Get the name of this appender.boolean
isStarted()
void
setName(java.lang.String name)
Set the name of this appender.void
start()
void
stop()
java.lang.String
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
-
started
protected volatile boolean started
-
guard
private boolean guard
The guard prevents an appender from repeatedly calling its own doAppend method.
-
name
protected java.lang.String name
Appenders are named.
-
fai
private FilterAttachableImpl<E> fai
-
statusRepeatCount
private int statusRepeatCount
-
exceptionCount
private int exceptionCount
-
ALLOWED_REPEATS
static final int ALLOWED_REPEATS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:Appender
Get the name of this appender. The name uniquely identifies the appender.
-
doAppend
public void doAppend(E eventObject)
Description copied from interface:Appender
This is where an appender accomplishes its work. Note that the argument is of type Object.
-
append
protected abstract void append(E eventObject)
-
setName
public void setName(java.lang.String name)
Set the name of this appender.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
addFilter
public void addFilter(Filter<E> newFilter)
Description copied from interface:FilterAttachable
Add a filter.- Specified by:
addFilter
in interfaceFilterAttachable<E>
-
clearAllFilters
public void clearAllFilters()
- Specified by:
clearAllFilters
in interfaceFilterAttachable<E>
-
getCopyOfAttachedFiltersList
public java.util.List<Filter<E>> getCopyOfAttachedFiltersList()
Description copied from interface:FilterAttachable
Get a copy of all the filters contained within this FilterAttachable object.- Specified by:
getCopyOfAttachedFiltersList
in interfaceFilterAttachable<E>
- Returns:
- all attached filters as a list
-
getFilterChainDecision
public FilterReply getFilterChainDecision(E event)
Description copied from interface:FilterAttachable
Loop through the filters in the chain. As soon as a filter decides on ACCEPT or DENY, then that value is returned. If all of the filters return NEUTRAL, then NEUTRAL is returned.- Specified by:
getFilterChainDecision
in interfaceFilterAttachable<E>
-
-