M
- The kind of OutputStreamManager
under managementpublic abstract class AbstractOutputStreamAppender<M extends OutputStreamManager> extends AbstractAppender
Modifier and Type | Class and Description |
---|---|
static class |
AbstractOutputStreamAppender.Builder<B extends AbstractOutputStreamAppender.Builder<B>>
Subclasses can extend this abstract Builder.
|
LifeCycle.State
Modifier and Type | Field and Description |
---|---|
private boolean |
immediateFlush
Immediate flush means that the underlying writer or output stream will be flushed at the end of each append
operation.
|
private M |
manager |
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
ELEMENT_TYPE
Modifier | Constructor and Description |
---|---|
protected |
AbstractOutputStreamAppender(java.lang.String name,
Layout<? extends java.io.Serializable> layout,
Filter filter,
boolean ignoreExceptions,
boolean immediateFlush,
M manager)
Instantiates a WriterAppender and set the output destination to a new
OutputStreamWriter
initialized with os as its OutputStream . |
Modifier and Type | Method and Description |
---|---|
void |
append(LogEvent event)
Actual writing occurs here.
|
protected void |
directEncodeEvent(LogEvent event) |
boolean |
getImmediateFlush()
Gets the immediate flush setting.
|
M |
getManager()
Gets the manager.
|
void |
start()
Make the Filter available for use.
|
boolean |
stop(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Cleanup the Filter.
|
protected boolean |
stop(long timeout,
java.util.concurrent.TimeUnit timeUnit,
boolean changeLifeCycleState)
Cleanup the Filter.
|
private void |
tryAppend(LogEvent event) |
protected void |
writeByteArrayToManager(LogEvent event) |
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toSerializable, toString
addFilter, getFilter, hasFilter, isFiltered, removeFilter
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
private 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 OutputStreamManager manager
protected AbstractOutputStreamAppender(java.lang.String name, Layout<? extends java.io.Serializable> layout, Filter filter, boolean ignoreExceptions, boolean immediateFlush, M manager)
OutputStreamWriter
initialized with os
as its OutputStream
.name
- The name of the Appender.layout
- The layout to format the message.manager
- The OutputStreamManager.public boolean getImmediateFlush()
public M getManager()
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 argumentprotected boolean stop(long timeout, java.util.concurrent.TimeUnit timeUnit, boolean changeLifeCycleState)
AbstractFilterable
stop
in class AbstractFilterable
public void append(LogEvent event)
Most subclasses of AbstractOutputStreamAppender
will need to override this method.
event
- The LogEvent.private void tryAppend(LogEvent event)
protected void directEncodeEvent(LogEvent event)
protected void writeByteArrayToManager(LogEvent event)