Class JdbcAppender.Builder<B extends JdbcAppender.Builder<B>>
- java.lang.Object
-
- org.apache.logging.log4j.core.filter.AbstractFilterable.Builder<B>
-
- org.apache.logging.log4j.core.appender.AbstractAppender.Builder<B>
-
- org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender.Builder<B>
-
- org.apache.logging.log4j.core.appender.db.jdbc.JdbcAppender.Builder<B>
-
- All Implemented Interfaces:
Builder<JdbcAppender>
- Enclosing class:
- JdbcAppender
public static class JdbcAppender.Builder<B extends JdbcAppender.Builder<B>> extends AbstractDatabaseAppender.Builder<B> implements Builder<JdbcAppender>
-
-
Field Summary
Fields Modifier and Type Field Description private intbufferSizeprivate ColumnConfig[]columnConfigsprivate ColumnMapping[]columnMappingsprivate ConnectionSourceconnectionSourceprivate booleanimmediateFailprivate longreconnectIntervalMillisprivate java.lang.StringtableNameprivate booleantruncateStrings
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JdbcAppenderbuild()Builds the object after all configuration has been set.longgetReconnectIntervalMillis()booleanisImmediateFail()BsetBufferSize(int bufferSize)If an integer greater than 0, this causes the appender to buffer log events and flush whenever the buffer reaches this size.BsetColumnConfigs(ColumnConfig... columnConfigs)Information about the columns that log event data should be inserted into and how to insert that data.BsetColumnMappings(ColumnMapping... columnMappings)BsetConnectionSource(ConnectionSource connectionSource)The connections source from which database connections should be retrieved.voidsetImmediateFail(boolean immediateFail)voidsetReconnectIntervalMillis(long reconnectIntervalMillis)BsetTableName(java.lang.String tableName)The name of the database table to insert log events into.BsetTruncateStrings(boolean truncateStrings)-
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender.Builder
getConfiguration, getErrorPrefix, getLayout, getName, getOrCreateLayout, getOrCreateLayout, isIgnoreExceptions, setConfiguration, setIgnoreExceptions, setLayout, setName, withConfiguration, withIgnoreExceptions, withLayout, withName
-
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable.Builder
asBuilder, getFilter, getPropertyArray, setFilter, setPropertyArray, withFilter
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.logging.log4j.core.util.Builder
getErrorPrefix, isValid
-
-
-
-
Field Detail
-
connectionSource
@PluginElement("ConnectionSource") @Required(message="No ConnectionSource provided") private ConnectionSource connectionSource
-
immediateFail
@PluginBuilderAttribute private boolean immediateFail
-
bufferSize
@PluginBuilderAttribute private int bufferSize
-
tableName
@PluginBuilderAttribute @Required(message="No table name provided") private java.lang.String tableName
-
columnConfigs
@PluginElement("ColumnConfigs") private ColumnConfig[] columnConfigs
-
columnMappings
@PluginElement("ColumnMappings") private ColumnMapping[] columnMappings
-
truncateStrings
@PluginBuilderAttribute private boolean truncateStrings
-
reconnectIntervalMillis
@PluginBuilderAttribute private long reconnectIntervalMillis
-
-
Method Detail
-
build
public JdbcAppender build()
Description copied from interface:BuilderBuilds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
buildin interfaceBuilder<B extends JdbcAppender.Builder<B>>- Returns:
- the configured instance.
-
getReconnectIntervalMillis
public long getReconnectIntervalMillis()
-
isImmediateFail
public boolean isImmediateFail()
-
setBufferSize
public B setBufferSize(int bufferSize)
If an integer greater than 0, this causes the appender to buffer log events and flush whenever the buffer reaches this size.- Parameters:
bufferSize- buffer size.- Returns:
- this
-
setColumnConfigs
public B setColumnConfigs(ColumnConfig... columnConfigs)
Information about the columns that log event data should be inserted into and how to insert that data.- Parameters:
columnConfigs- Column configurations.- Returns:
- this
-
setColumnMappings
public B setColumnMappings(ColumnMapping... columnMappings)
-
setConnectionSource
public B setConnectionSource(ConnectionSource connectionSource)
The connections source from which database connections should be retrieved.- Parameters:
connectionSource- The connections source.- Returns:
- this
-
setImmediateFail
public void setImmediateFail(boolean immediateFail)
-
setReconnectIntervalMillis
public void setReconnectIntervalMillis(long reconnectIntervalMillis)
-
setTableName
public B setTableName(java.lang.String tableName)
The name of the database table to insert log events into.- Parameters:
tableName- The database table name.- Returns:
- this
-
setTruncateStrings
public B setTruncateStrings(boolean truncateStrings)
-
-