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.jdbc
Class JdbcAppender

    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<JdbcDatabaseManager>
                      org.apache.logging.log4j.core.appender.db.jdbc.JdbcAppender

All Implemented Interfaces:
  Serializable, Appender, Filterable, LifeCycle

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

extends AbstractDatabaseAppender<JdbcDatabaseManager>

This Appender writes logging events to a relational database using standard JDBC mechanisms. It takes a list of `ColumnConfig`s with which it determines how to save the event data into the appropriate columns in the table. A `ConnectionSource` plugin instance instructs the appender (and `JdbcDatabaseManager`) how to connect to the database. This appender can be reconfigured at run time.

See Also:
  `ColumnConfig`, `ConnectionSource`, 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
`static JdbcAppender` | `createAppender(String name, String ignore, Filter filter, ConnectionSource connectionSource, String bufferSize, String tableName, ColumnConfig[] columnConfigs)` Factory method for creating a JDBC appender within the plugin manager.
`String` | `toString()`

Methods inherited from class org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender
`append, getLayout, getManager, replaceManager, start, stop`

Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
`error, error, error, getHandler, getName, ignoreExceptions, parseInt, setHandler`

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

### toString

    public String toString()

  Overrides:
    `toString` in class `AbstractAppender`

### createAppender

    @PluginFactory
    public static JdbcAppender createAppender(@PluginAttribute(value="name")
                                                            String name,
                                                            @PluginAttribute(value="ignoreExceptions")
                                                            String ignore,
                                                            @PluginElement(value="Filter")
                                                            Filter filter,
                                                            @PluginElement(value="ConnectionSource")
                                                            ConnectionSource connectionSource,
                                                            @PluginAttribute(value="bufferSize")
                                                            String bufferSize,
                                                            @PluginAttribute(value="tableName")
                                                            String tableName,
                                                            @PluginElement(value="ColumnConfigs")
                                                            ColumnConfig[] columnConfigs)

  Factory method for creating a JDBC appender within the plugin manager.

  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.
    `filter` - The filter, if any, to use.
    `connectionSource` - The connections source from which database connections should be retrieved.
    `bufferSize` - If an integer greater than 0, this causes the appender to buffer log events and flush whenever the buffer reaches this size.
    `tableName` - The name of the database table to insert log events into.
    `columnConfigs` - Information about the columns that log event data should be inserted into and how to insert that data.
  Returns:
    a new JDBC appender.

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.