public class OutputStreamAppender<E> extends UnsynchronizedAppenderBase<E>
OutputStream
. This class
provides basic services that other appenders build upon.
For more information about this appender, please refer to the online manual
at http://logback.qos.ch/manual/appenders.html#OutputStreamAppenderModifier and Type | Field and Description |
---|---|
protected Encoder<E> |
encoder
It is the encoder which is ultimately responsible for writing the event to
an
OutputStream . |
protected ReentrantLock |
lock
All synchronization in this class is done via the lock object.
|
name, started
context
Constructor and Description |
---|
OutputStreamAppender() |
Modifier and Type | Method and Description |
---|---|
protected void |
append(E eventObject) |
protected void |
closeOutputStream()
Close the underlying
OutputStream . |
Encoder<E> |
getEncoder() |
OutputStream |
getOutputStream()
The underlying output stream used by this appender.
|
boolean |
isImmediateFlush() |
void |
setEncoder(Encoder<E> encoder) |
void |
setImmediateFlush(boolean immediateFlush) |
void |
setLayout(Layout<E> layout) |
void |
setOutputStream(OutputStream outputStream)
Sets the @link OutputStream} where the log output will go.
|
void |
start()
Checks that requires parameters are set and if everything is in order,
activates this appender.
|
void |
stop()
Stop this appender instance.
|
protected void |
subAppend(E event)
Actual writing occurs here.
|
protected void |
writeOut(E event) |
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
protected Encoder<E> encoder
OutputStream
.protected final ReentrantLock lock
public OutputStream getOutputStream()
public void start()
start
in interface LifeCycle
start
in class UnsynchronizedAppenderBase<E>
protected void append(E eventObject)
append
in class UnsynchronizedAppenderBase<E>
public void stop()
Stopped appenders cannot be reused.
stop
in interface LifeCycle
stop
in class UnsynchronizedAppenderBase<E>
protected void closeOutputStream()
OutputStream
.public void setOutputStream(OutputStream outputStream)
Sets the @link OutputStream} where the log output will go. The specified
OutputStream
must be opened by the user and be writable. The
OutputStream
will be closed when the appender instance is
closed.
outputStream
- An already opened OutputStream.protected void writeOut(E event) throws IOException
IOException
protected void subAppend(E event)
Most subclasses of WriterAppender
will need to override this
method.
public boolean isImmediateFlush()
public void setImmediateFlush(boolean immediateFlush)
Copyright © 2005–2021 QOS.ch. All rights reserved.