Class AbstractOutputStreamAppender<M extends OutputStreamManager>

    • Field Detail

      • immediateFlush

        private final boolean immediateFlush
        Immediate flush means that the underlying writer or output stream will be flushed at the end of each append operation. Immediate flush is slower but ensures that each append request is actually written. If immediateFlush is set to false, then there is a good chance that the last few logs events are not actually written to persistent media if and when the application crashes.
    • Constructor Detail

      • AbstractOutputStreamAppender

        @Deprecated
        protected AbstractOutputStreamAppender​(java.lang.String name,
                                               Layout<? extends java.io.Serializable> layout,
                                               Filter filter,
                                               boolean ignoreExceptions,
                                               boolean immediateFlush,
                                               M manager)
        Instantiates a WriterAppender and set the output destination to a new OutputStreamWriter initialized with os as its OutputStream.
        Parameters:
        name - The name of the Appender.
        layout - The layout to format the message.
        manager - The OutputStreamManager.
      • AbstractOutputStreamAppender

        protected AbstractOutputStreamAppender​(java.lang.String name,
                                               Layout<? extends java.io.Serializable> layout,
                                               Filter filter,
                                               boolean ignoreExceptions,
                                               boolean immediateFlush,
                                               Property[] properties,
                                               M manager)
        Instantiates a WriterAppender and set the output destination to a new OutputStreamWriter initialized with os as its OutputStream.
        Parameters:
        name - The name of the Appender.
        layout - The layout to format the message.
        properties - optional properties
        manager - The OutputStreamManager.
    • Method Detail

      • getImmediateFlush

        public boolean getImmediateFlush()
        Gets the immediate flush setting.
        Returns:
        immediate flush.
      • getManager

        public M getManager()
        Gets the manager.
        Returns:
        the manager.
      • stop

        public boolean stop​(long timeout,
                            java.util.concurrent.TimeUnit timeUnit)
        Description copied from class: AbstractFilterable
        Cleanup the Filter.
        Specified by:
        stop in interface LifeCycle2
        Overrides:
        stop in class AbstractFilterable
        Parameters:
        timeout - the maximum time to wait
        timeUnit - the time unit of the timeout argument
        Returns:
        true if the receiver was stopped cleanly and normally, false otherwise.
      • stop

        protected boolean stop​(long timeout,
                               java.util.concurrent.TimeUnit timeUnit,
                               boolean changeLifeCycleState)
        Description copied from class: AbstractFilterable
        Cleanup the Filter.
        Overrides:
        stop in class AbstractFilterable
      • append

        public void append​(LogEvent event)
        Actual writing occurs here.

        Most subclasses of AbstractOutputStreamAppender will need to override this method.

        Parameters:
        event - The LogEvent.
      • tryAppend

        private void tryAppend​(LogEvent event)
      • directEncodeEvent

        protected void directEncodeEvent​(LogEvent event)
      • writeByteArrayToManager

        protected void writeByteArrayToManager​(LogEvent event)