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.routing
Class RoutingAppender

    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.routing.RoutingAppender

All Implemented Interfaces:
  Serializable, Appender, Filterable, LifeCycle

    @Plugin(name="Routing",
            category="Core",
            elementType="appender",
            printObject=true)
    public final class RoutingAppender

extends AbstractAppender

This Appender "routes" between various Appenders, some of which can be references to Appenders defined earlier in the configuration while others can be dynamically created within this Appender as required. Routing is achieved by specifying a pattern on the Routing appender declaration. The pattern should contain one or more substitution patterns of the form "$${[key:]token}". The pattern will be resolved each time the Appender is called using the built in StrSubstitutor and the StrLookup plugin that matches the specified key.

See Also:
  Serialized Form

Nested Class Summary

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

Field Summary

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

Method Summary
`void` | `append(LogEvent event)` Logs a LogEvent using whatever logic this Appender wishes to use.
`static RoutingAppender` | `createAppender(String name, String ignore, Routes routes, Configuration config, RewritePolicy rewritePolicy, Filter filter)` Create a RoutingAppender.
`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`

Method Detail

### 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)

  Description copied from interface: `Appender`
  Logs a LogEvent using whatever logic this Appender wishes to use. It is typically recommended to use a bridge pattern not only for the benefits from decoupling an Appender from its implementation, but it is also handy for sharing resources which may require some form of locking.

  Parameters:
    `event` - The LogEvent.

### createAppender

    @PluginFactory
    public static RoutingAppender createAppender(@PluginAttribute(value="name")
                                                               String name,
                                                               @PluginAttribute(value="ignoreExceptions")
                                                               String ignore,
                                                               @PluginElement(value="Routes")
                                                               Routes routes,
                                                               @PluginConfiguration
                                                               Configuration config,
                                                               @PluginElement(value="RewritePolicy")
                                                               RewritePolicy rewritePolicy,
                                                               @PluginElement(value="Filter")
                                                               Filter filter)

  Create a RoutingAppender.

  Parameters:
    `name` - The name of the Appender.
    `ignore` - If `"true"` (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
    `routes` - The routing definitions.
    `config` - The Configuration (automatically added by the Configuration).
    `rewritePolicy` - A RewritePolicy, if any.
    `filter` - A Filter to restrict events processed by the Appender or null.
  Returns:
    The RoutingAppender

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.