Class LayoutWrappingEncoder<E>

    • Field Detail

      • layout

        protected Layout<E> layout
    • Constructor Detail

      • LayoutWrappingEncoder

        public LayoutWrappingEncoder()
    • Method Detail

      • 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
      • isImmediateFlush

        public boolean isImmediateFlush()
      • getLayout

        public Layout<E> getLayout()
      • setLayout

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

        public Charset getCharset()
      • setCharset

        public void setCharset(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 -
      • init

        public void init(OutputStream os)
                  throws IOException
        Description copied from interface: Encoder
        This method is called when the owning appender starts or whenever output needs to be directed to a new OutputStream, for instance as a result of a rollover. Implementing encoders should at the very least remember the OutputStream passed as argument and use it in future operations.
        Specified by:
        init in interface  Encoder<E>
        Overrides:
        init in class  EncoderBase<E>
        Throws:
        IOException -
      • close

        public void close()
                   throws IOException
        Description copied from interface: Encoder
        This method is called prior to the closing of the underling OutputStream. Implementations MUST not close the underlying OutputStream which is the responsibility of the owning appender.
        Throws:
        IOException -
      • doEncode

        public void doEncode(E event)
                      throws IOException
        Description copied from interface: Encoder
        Encode and write an event to the appropriate OutputStream. Implementations are free to differ writing out of the encoded event and instead write in batches.
        Throws:
        IOException -
      • isStarted

        public boolean isStarted()
      • start

        public void start()
      • stop

        public void stop()