Class AbstractDatabaseAppender<T extends AbstractDatabaseManager>

Type Parameters:
T - Specifies which type of AbstractDatabaseManager this Appender requires.
All Implemented Interfaces:
Appender, Filterable, LocationAware, LifeCycle, LifeCycle2
Direct Known Subclasses:
JdbcAppender, NoSqlAppender

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.
  • Field Details

    • DEFAULT_RECONNECT_INTERVAL_MILLIS

      public static final int DEFAULT_RECONNECT_INTERVAL_MILLIS
      See Also:
  • Constructor Details

  • Method Details

    • 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.
    • 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.
    • 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.
    • 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 boolean stop(long timeout, TimeUnit timeUnit)
      Description copied from class: AbstractFilterable
      Cleanup the Filter.
      Specified by:
      stop in interface LifeCycle2
      Overrides:
      stop in class AbstractFilterable
      Parameters:
      timeout - the maximum time to wait
      timeUnit - the time unit of the timeout argument
      Returns:
      true if the receiver was stopped cleanly and normally, false otherwise.