Class AbstractOutputStreamAppender<M extends OutputStreamManager>

Type Parameters:
M - The kind of OutputStreamManager under management
All Implemented Interfaces:
Appender, Filterable, LocationAware, LifeCycle, LifeCycle2
Direct Known Subclasses:
AbstractFileAppender, ConsoleAppender, FileAppender, MemoryMappedFileAppender, OutputStreamAppender, RandomAccessFileAppender, RollingFileAppender, RollingRandomAccessFileAppender, SocketAppender

public abstract class AbstractOutputStreamAppender<M extends OutputStreamManager> extends AbstractAppender
Appends log events as bytes to a byte output stream. The stream encoding is defined in the layout.
  • Constructor Details

    • AbstractOutputStreamAppender

      @Deprecated protected AbstractOutputStreamAppender(String name, Layout<? extends 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(String name, Layout<? extends 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.
      filter - The filter to associate with the Appender.
      ignoreExceptions - If true, exceptions will be logged and suppressed. If false errors will be logged and then passed to the application.
      immediateFlush - Underlying output stream will be flushed at the end of each append operation.
      properties - optional properties
      manager - The OutputStreamManager.
  • Method Details

    • getImmediateFlush

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

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

      public void start()
      Description copied from class: AbstractFilterable
      Make the Filter available for use.
      Specified by:
      start in interface LifeCycle
      Overrides:
      start in class AbstractFilterable
    • stop

      public boolean stop(long timeout, 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, 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.
    • directEncodeEvent

      protected void directEncodeEvent(LogEvent event)
    • writeByteArrayToManager

      protected void writeByteArrayToManager(LogEvent event)