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.db
Class AbstractDatabaseAppender<T extends AbstractDatabaseManager>

    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.db.AbstractDatabaseAppender<T>

Type Parameters:
  `T` - Specifies which type of `AbstractDatabaseManager` this Appender requires.

All Implemented Interfaces:
  Serializable, Appender, Filterable, LifeCycle

Direct Known Subclasses:
  JdbcAppender, JpaAppender

    public abstract class AbstractDatabaseAppender<T extends AbstractDatabaseManager>

extends AbstractAppender

An abstract Appender for writing events to a database of some type, be it relational or NoSQL. All database appenders should inherit from this base appender. Three implementations are currently provided: `JDBC`, `JPA`, and NoSQL.

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`

Constructor Summary
`protected` | `AbstractDatabaseAppender(String name, Filter filter, boolean ignoreExceptions, T manager)` Instantiates the base appender.

Method Summary
`void` | `append(LogEvent event)` Logs a LogEvent using whatever logic this Appender wishes to use.
`Layout<LogEvent>` | `getLayout()` This always returns `null`, as database appenders do not use a single layout.
`T` | `getManager()` Returns the underlying manager in use within this appender.
`protected void` | `replaceManager(T manager)` Replaces the underlying manager in use within this appender.
`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, 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`

Constructor Detail

### AbstractDatabaseAppender

    protected AbstractDatabaseAppender(String name,
                                       Filter filter,
                                       boolean ignoreExceptions,
                                       T manager)

  Instantiates the base appender.

  Parameters:
    `name` - The appender name.
    `filter` - The filter, if any, to use.
    `ignoreExceptions` - If `true` exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
    `manager` - The matching `AbstractDatabaseManager` implementation.

Method Detail

### getLayout

    public final Layout<LogEvent> getLayout()

  This always returns `null`, as database appenders do not use a single layout. The JPA and NoSQL appenders do not use a layout at all. The JDBC appender has a layout-per-column pattern.

  Specified by:
    `getLayout` in interface `Appender`
  Overrides:
    `getLayout` in class `AbstractAppender`
  Returns:
    `null`.

### getManager

    public final T getManager()

  Returns the underlying manager in use within this appender.

  Returns:
    the manager.

### start

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

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

  Specified by:
    `stop` in interface `LifeCycle`
  Overrides:
    `stop` in class `AbstractFilterable`

### append

    public final 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.

### replaceManager

    protected final void replaceManager(T manager)

  Replaces the underlying manager in use within this appender. This can be useful for manually changing the way log events are written to the database without losing buffered or in-progress events. The existing manager is released only after the new manager has been installed. This method is thread-safe.

  Parameters:
    `manager` - The new manager to install.

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.