org.apache.logging.log4j.core.appender
Class AsyncAppender<T extends Serializable>

java.lang.Object
  extended by org.apache.logging.log4j.core.filter.AbstractFilterable
      extended by org.apache.logging.log4j.core.appender.AbstractAppender<T>
          extended by org.apache.logging.log4j.core.appender.AsyncAppender<T>
Type Parameters:
T - The Layout's Serializable type.
All Implemented Interfaces:
Appender<T>, Filterable, LifeCycle

public final class AsyncAppender<T extends Serializable>
extends AbstractAppender<T>

Appends to one or more Appenders asynchronously. You can configure an AsyncAppender with one or more Appenders and an Appender to append to if the queue is full. The AsyncAppender does not allow a filter to be specified on the Appender references.


Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
LOGGER
 
Method Summary
 void append(LogEvent event)
          Actual writing occurs here.
static
<S extends Serializable>
AsyncAppender<S>
createAppender(AppenderRef[] appenderRefs, String errorRef, String blocking, String size, String name, String includeLocation, Filter filter, Configuration config, String suppress)
          Create an AsyncAppender.
 void start()
          Start the Appender.
 void stop()
          Stop the Appender.
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
close, error, error, error, getHandler, getLayout, getName, isExceptionSuppressed, isStarted, setHandler, toString
 
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, hasFilter, isFiltered, removeFilter, startFilter, stopFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

start

public void start()
Description copied from class: AbstractAppender
Start the Appender.

Specified by:
start in interface LifeCycle
Overrides:
start in class AbstractAppender<T extends Serializable>

stop

public void stop()
Description copied from class: AbstractAppender
Stop the Appender.

Specified by:
stop in interface LifeCycle
Overrides:
stop in class AbstractAppender<T extends Serializable>

append

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

Parameters:
event - The LogEvent.

createAppender

public static <S extends Serializable> AsyncAppender<S> createAppender(AppenderRef[] appenderRefs,
                                                                       String errorRef,
                                                                       String blocking,
                                                                       String size,
                                                                       String name,
                                                                       String includeLocation,
                                                                       Filter filter,
                                                                       Configuration config,
                                                                       String suppress)
Create an AsyncAppender.

Type Parameters:
S - The actual type of the Serializable.
Parameters:
appenderRefs - The Appenders to reference.
errorRef - An optional Appender to write to if the queue is full or other errors occur.
blocking - True if the Appender should wait when the queue is full. The default is true.
size - The size of the event queue. The default is 128.
name - The name of the Appender.
includeLocation - whether to include location information. The default is false.
filter - The Filter or null.
config - The Configuration.
suppress - "true" if exceptions should be hidden from the application, "false" otherwise. The default is "true".
Returns:
The AsyncAppender.


Copyright © 1999-2013 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.