Class LayoutWrappingEncoder<E>

    • Field Detail

      • layout

        protected Layout<E> layout
      • charset

        private java.nio.charset.Charset charset
        The charset to use when converting a String into bytes.

        By default this property has the value null which corresponds to the system's default charset.

      • immediateFlush

        java.lang.Boolean immediateFlush
    • Constructor Detail

      • LayoutWrappingEncoder

        public LayoutWrappingEncoder()
    • Method Detail

      • getLayout

        public Layout<E> getLayout()
      • setLayout

        public void setLayout​(Layout<E> layout)
      • getCharset

        public java.nio.charset.Charset getCharset()
      • setCharset

        public void setCharset​(java.nio.charset.Charset charset)
        Set the charset to use when converting the string returned by the layout into bytes.

        By default this property has the value null 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: Encoder
        Get header bytes. This method is typically called upon opening of an output stream.
        Returns:
        header bytes. Null values are allowed.
      • footerBytes

        public byte[] footerBytes()
        Description copied from interface: Encoder
        Get footer bytes. This method is typically called prior to the closing of the stream where events are written.
        Returns:
        footer bytes. Null values are allowed.
      • convertToBytes

        private byte[] convertToBytes​(java.lang.String s)
      • encode

        public byte[] encode​(E event)
        Description copied from interface: Encoder
        Encode an event as bytes.
      • appendIfNotNull

        private void appendIfNotNull​(java.lang.StringBuilder sb,
                                     java.lang.String s)
      • setParent

        public void setParent​(ContextAware parent)
        This method allows RollingPolicy implementations to be aware of their containing appender.
        Parameters:
        parent -