org.apache.logging.log4j.core.appender
Class FailoverAppender<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.FailoverAppender<T>
All Implemented Interfaces:
Appender<T>, Filterable, LifeCycle

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

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.


Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
LOGGER
 
Method Summary
 void append(LogEvent event)
          Handle the Log event.
static
<S extends Serializable>
FailoverAppender<S>
createAppender(String name, String primary, String[] failovers, String interval, Configuration config, Filter filter, String suppress)
          Create a Failover Appender.
 void start()
          Start the Appender.
 String toString()
           
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
close, error, error, error, getHandler, getLayout, getName, isExceptionSuppressed, isStarted, setHandler, stop
 
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>

append

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

Parameters:
event - The LogEvent.

toString

public String toString()
Overrides:
toString in class AbstractAppender<T extends Serializable>

createAppender

public static <S extends Serializable> FailoverAppender<S> createAppender(String name,
                                                                          String primary,
                                                                          String[] failovers,
                                                                          String interval,
                                                                          Configuration config,
                                                                          Filter filter,
                                                                          String suppress)
Create a Failover Appender.

Parameters:
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).
interval - The retry interval.
config - The current Configuration (passed by the Configuration when the appender is created).
filter - A Filter (optional).
suppress - "true" if exceptions should be hidden from the application, "false" otherwise. The default is "true".
Returns:
The FailoverAppender that was created.


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.