Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.logging.log4j.core.appender
Class AbstractOutputStreamAppender<M extends OutputStreamManager>

    java.lang.Object
      org.apache.logging.log4j.core.AbstractLifeCycle
          org.apache.logging.log4j.core.filter.AbstractFilterable
              org.apache.logging.log4j.core.appender.AbstractAppender
                  org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<M>

Type Parameters:
  `M` - The kind of `OutputStreamManager` under management

All Implemented Interfaces:
  Serializable, Appender, Filterable, LifeCycle

Direct Known Subclasses:
  ConsoleAppender, FileAppender, MemoryMappedFileAppender, 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.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
`LifeCycle.State`

Field Summary
`protected boolean` | `immediateFlush` Immediate flush means that the underlying writer or output stream will be flushed at the end of each append operation.

Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
`LOGGER`

Constructor Summary
`protected` | `AbstractOutputStreamAppender(String name, Layout<? extends Serializable> layout, Filter filter, boolean ignoreExceptions, boolean immediateFlush, M manager)` Instantiate a WriterAppender and set the output destination to a new `OutputStreamWriter` initialized with `os` as its `OutputStream`.

Method Summary
`void` | `append(LogEvent event)` Actual writing occurs here.
`M` | `getManager()` Gets the manager.
`void` | `start()` Make the Filter available for use.
`void` | `stop()` Cleanup the Filter.

Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
`error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString`

Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
`addFilter, getFilter, hasFilter, isFiltered, removeFilter`

Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
`equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
`getState, isStarted, isStopped`

Field Detail

### immediateFlush

    protected 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

    protected AbstractOutputStreamAppender(String name,
                                           Layout<? extends Serializable> layout,
                                           Filter filter,
                                           boolean ignoreExceptions,
                                           boolean immediateFlush,
                                           M manager)

  Instantiate 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.

Method Detail

### 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 void stop()

  Description copied from class: `AbstractFilterable`
  Cleanup the Filter.

  Specified by:
    `stop` in interface `LifeCycle`
  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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.