M
- The kind of WriterManager
under managementpublic abstract class AbstractWriterAppender<M extends WriterManager> extends AbstractAppender
AbstractAppender.Builder<B extends AbstractAppender.Builder<B>>
LifeCycle.State
Modifier and Type | Field and Description |
---|---|
protected boolean |
immediateFlush
Immediate flush means that the underlying writer will be flushed at the
end of each append operation.
|
private M |
manager |
private java.util.concurrent.locks.Lock |
readLock |
private java.util.concurrent.locks.ReadWriteLock |
readWriteLock |
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
ELEMENT_TYPE
Modifier | Constructor and Description |
---|---|
protected |
AbstractWriterAppender(java.lang.String name,
StringLayout layout,
Filter filter,
boolean ignoreExceptions,
boolean immediateFlush,
M manager)
Instantiates.
|
Modifier and Type | Method and Description |
---|---|
void |
append(LogEvent event)
Actual writing occurs here.
|
M |
getManager()
Gets the manager.
|
StringLayout |
getStringLayout() |
void |
start()
Make the Filter available for use.
|
boolean |
stop(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Cleanup the Filter.
|
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString
addFilter, getFilter, hasFilter, isFiltered, removeFilter, stop
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
protected final boolean immediateFlush
immediateFlush
is set to false
, then there is a good chance that the last few
logs events are not actually written to persistent media if and when the
application crashes.private final M extends WriterManager manager
private final java.util.concurrent.locks.ReadWriteLock readWriteLock
private final java.util.concurrent.locks.Lock readLock
protected AbstractWriterAppender(java.lang.String name, StringLayout layout, Filter filter, boolean ignoreExceptions, boolean immediateFlush, M manager)
name
- The name of the Appender.layout
- The layout to format the message.manager
- The OutputStreamManager.public void append(LogEvent event)
Most subclasses will need to override this method.
event
- The LogEvent.public M getManager()
public StringLayout getStringLayout()
public void start()
AbstractFilterable
start
in interface LifeCycle
start
in class AbstractFilterable
public boolean stop(long timeout, java.util.concurrent.TimeUnit timeUnit)
AbstractFilterable
stop
in interface LifeCycle2
stop
in class AbstractFilterable
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argument