Package ch.qos.logback.core.encoder
Class LayoutWrappingEncoder<E>
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.encoder.EncoderBase<E>
ch.qos.logback.core.encoder.LayoutWrappingEncoder<E>
- All Implemented Interfaces:
Encoder<E>,ContextAware,LifeCycle
- Direct Known Subclasses:
PatternLayoutEncoderBase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CharsetThe charset to use when converting a String into bytes.(package private) Boolean(package private) ContextAwareFields inherited from class ch.qos.logback.core.encoder.EncoderBase
startedFields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappendIfNotNull(StringBuilder sb, String s) private byte[]byte[]Encode an event as bytes.byte[]Get footer bytes.byte[]Get header bytes.booleanvoidsetCharset(Charset charset) Set the charset to use when converting the string returned by the layout into bytes.voidsetImmediateFlush(boolean immediateFlush) Sets the immediateFlush option.voidvoidsetParent(ContextAware parent) This method allows RollingPolicy implementations to be aware of their containing appender.voidstart()voidstop()Methods 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, toString, wait, wait, waitMethods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Field Details
-
layout
-
charset
The charset to use when converting a String into bytes. By default this property has the valuenull which corresponds to the system's default charset. -
parent
ContextAware parent -
immediateFlush
Boolean immediateFlush
-
-
Constructor Details
-
LayoutWrappingEncoder
public LayoutWrappingEncoder()
-
-
Method Details
-
getLayout
-
setLayout
-
getCharset
-
setCharset
Set the charset to use when converting the string returned by the layout into bytes. By default this property has the valuenull which corresponds to the system's default charset.- Parameters:
charset-
-
setImmediateFlush
public void setImmediateFlush(boolean immediateFlush) Sets the immediateFlush option. The default value for immediateFlush is 'true'. If set to true, the doEncode() method will immediately flush the underlying OutputStream. Although immediate flushing is safer, it also significantly degrades logging throughput.- Since:
- 1.0.3
-
headerBytes
public byte[] headerBytes()Description copied from interface:EncoderGet header bytes. This method is typically called upon opening of an output stream.- Returns:
- header bytes. Null values are allowed.
-
convertToBytes
-
encode
Description copied from interface:EncoderEncode an event as bytes.- Parameters:
event-
-
isStarted
public boolean isStarted()- Specified by:
isStartedin interfaceLifeCycle- Overrides:
isStartedin classEncoderBase<E>
-
start
public void start()- Specified by:
startin interfaceLifeCycle- Overrides:
startin classEncoderBase<E>
-
stop
public void stop()- Specified by:
stopin interfaceLifeCycle- Overrides:
stopin classEncoderBase<E>
-
appendIfNotNull
-
setParent
This method allows RollingPolicy implementations to be aware of their containing appender.- Parameters:
parent-
-