-
- Type Parameters:
E- the event type accepted by this appender
- All Superinterfaces:
ContextAware,FilterAttachable<E>,LifeCycle
- All Known Implementing Classes:
AbstractSocketAppender,AbstractSSLSocketAppender,AppenderBase,AsyncAppender,AsyncAppenderBase,ConsoleAppender,CyclicBufferAppender,DelayingListAppender,FileAppender,ListAppender,NOPAppender,NPEAppender,OutputStreamAppender,RollingFileAppender,SiftingAppender,SiftingAppenderBase,SMTPAppender,SMTPAppenderBase,SocketAppender,SSLSocketAppender,StringListAppender,SyslogAppender,SyslogAppenderBase,UnsynchronizedAppenderBase,WithLayoutListAppender
public interface Appender<E> extends LifeCycle, ContextAware, FilterAttachable<E>
Contract for components responsible for delivering logging events to their final destination (console, file, remote server, etc.).Implementations are typically configured and managed by a LoggerContext. The type parameter E represents the event type the appender consumes (for example a log event object). Implementations should honor lifecycle methods from
LifeCycleand may beContextAwareandFilterAttachableto support contextual information and filtering.Concurrency: appenders are generally invoked by multiple threads. Implementations must ensure thread-safety where applicable (for example when writing to shared resources). The
doAppend(Object)method may be called concurrently.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddoAppend(E event)This is where an appender accomplishes its work: format and deliver the provided event to the appender's destination.StringgetName()Get the name of this appender.voidsetName(String name)Set the name of this appender.-
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Methods inherited from interface ch.qos.logback.core.spi.FilterAttachable
addFilter, clearAllFilters, getCopyOfAttachedFiltersList, getFilterChainDecision
-
-
-
-
Method Detail
-
getName
String getName()
Get the name of this appender. The name uniquely identifies the appender within its context and is used for configuration and lookup.- Returns:
- the appender name, or
nullif not set
-
doAppend
void doAppend(E event) throws LogbackException
This is where an appender accomplishes its work: format and deliver the provided event to the appender's destination.Implementations should apply any configured filters before outputting the event. Implementations should avoid throwing runtime exceptions; if an error occurs that cannot be handled internally, a
LogbackException(or a subtype) may be thrown to indicate a failure during append.- Parameters:
event- the event to append; may not benull- Throws:
LogbackException- if the append fails in a way that needs to be propagated to the caller
-
-