Class FailoverAppender

  extended by org.apache.logging.log4j.core.AbstractLifeCycle
      extended by org.apache.logging.log4j.core.filter.AbstractFilterable
          extended by org.apache.logging.log4j.core.appender.AbstractAppender
              extended by org.apache.logging.log4j.core.appender.FailoverAppender
All Implemented Interfaces:
Serializable, Appender, Filterable, LifeCycle

public final class FailoverAppender
extends AbstractAppender

The FailoverAppender will capture exceptions in an Appender and then route the event to a different appender. Hopefully it is obvious that the Appenders must be configured to not suppress exceptions for the FailoverAppender to work.

See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
Field Summary
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
Method Summary
 void append(LogEvent event)
          Handle the Log event.
static FailoverAppender createAppender(String name, String primary, String[] failovers, String retryIntervalSeconds, Configuration config, Filter filter, String ignore)
          Create a Failover Appender.
 void start()
          Make the Filter available for use.
 String toString()
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, hasFilter, isFiltered, removeFilter, stop
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, stop

Method Detail


public void start()
Description copied from class: AbstractFilterable
Make the Filter available for use.

Specified by:
start in interface LifeCycle
start in class AbstractFilterable


public void append(LogEvent event)
Handle the Log event.

event - The LogEvent.


public String toString()
toString in class AbstractAppender


public static FailoverAppender createAppender(@PluginAttribute(value="name")
                                                            String name,
                                                            String primary,
                                                            String[] failovers,
                                                            String retryIntervalSeconds,
                                                            Configuration config,
                                                            Filter filter,
                                                            String ignore)
Create a Failover Appender.

name - The name of the Appender (required).
primary - The name of the primary Appender (required).
failovers - The name of one or more Appenders to fail over to (at least one is required).
retryIntervalSeconds - The retry interval in seconds.
config - The current Configuration (passed by the Configuration when the appender is created).
filter - A Filter (optional).
ignore - If "true" (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
The FailoverAppender that was created.

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.