java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.UnsynchronizedAppenderBase<E>
ch.qos.logback.core.OutputStreamAppender<E>
- All Implemented Interfaces:
Appender<E>,ContextAware,FilterAttachable<E>,LifeCycle
- Direct Known Subclasses:
ConsoleAppender,FileAppender
OutputStreamAppender appends events to a
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#OutputStreamAppender- Author:
- Ceki Gülcü
-
Field Summary
FieldsModifier and TypeFieldDescriptionIt is the encoder which is ultimately responsible for writing the event to anOutputStream.protected final ReentrantLockAll synchronization in this class is done via the lock object.Fields inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
name, startedFields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidClose the underlyingOutputStream.The underlying output stream used by this appender.booleanvoidsetEncoder(Encoder<E> encoder) voidsetImmediateFlush(boolean immediateFlush) voidvoidsetOutputStream(OutputStream outputStream) Sets the @link OutputStream} where the log output will go.voidstart()Checks that requires parameters are set and if everything is in order, activates this appender.voidstop()Stop this appender instance.protected voidActual writing occurs here.protected voidupdateByteCount(byte[] byteArray) protected final voidwriteByteArrayToOutputStreamWithPossibleFlush(byte[] byteArray) A simple method to write to an outputStream and flush the stream if immediateFlush is set to true.protected voidMethods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toStringMethods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Field Details
-
encoder
It is the encoder which is ultimately responsible for writing the event to anOutputStream. -
streamWriteLock
All synchronization in this class is done via the lock object.
-
-
Constructor Details
-
OutputStreamAppender
public OutputStreamAppender()
-
-
Method Details
-
getOutputStream
-
start
-
setLayout
-
append
- Specified by:
appendin classUnsynchronizedAppenderBase<E>
-
stop
-
closeOutputStream
Close the underlyingOutputStream. -
setOutputStream
Sets the @link OutputStream} where the log output will go. The specified
OutputStreammust be opened by the user and be writable. TheOutputStreamwill be closed when the appender instance is closed.- Parameters:
outputStream- An already opened OutputStream.
-
writeOut
- Throws:
IOException
-
updateByteCount
-
writeByteArrayToOutputStreamWithPossibleFlush
protected final void writeByteArrayToOutputStreamWithPossibleFlush(byte[] byteArray) throws IOException A simple method to write to an outputStream and flush the stream if immediateFlush is set to true.- Throws:
IOException- Since:
- 1.3.9/1.4.9
-
subAppend
-
getEncoder
-
setEncoder
-
isImmediateFlush
-
setImmediateFlush
-