public class DefaultJDBCTarget extends AbstractJDBCTarget
Constructor and Description |
---|
DefaultJDBCTarget(DataSource dataSource,
String table,
ColumnInfo[] columns)
Creation of a new JDBC logging target.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeConnection()
Close connection to underlying database.
|
protected ColumnInfo |
getColumn(int index)
Return the column info for an supplied index.
|
protected String |
getStatementSQL()
Return the SQL insert statement.
|
protected String |
getTable()
Return the underlying table
|
protected boolean |
isStale()
Test if the target is stale.
|
protected void |
openConnection()
Open connection to underlying database.
|
protected void |
output(LogEvent event)
Output a log event to DB.
|
protected void |
specifyColumn(PreparedStatement statement,
int index,
LogEvent event)
Adds a single object into statement.
|
checkConnection, close, doProcessEvent, getConnection, open
getErrorHandler, isOpen, processEvent, setErrorHandler
public DefaultJDBCTarget(DataSource dataSource, String table, ColumnInfo[] columns)
dataSource
- the JDBC datasourcetable
- the tablecolumns
- a ColumnInfo arrayprotected void output(LogEvent event)
output
in class AbstractJDBCTarget
event
- the log event.protected void openConnection()
openConnection
in class AbstractJDBCTarget
protected String getStatementSQL()
protected boolean isStale()
isStale
in class AbstractJDBCTarget
protected void closeConnection()
closeConnection
in class AbstractJDBCTarget
protected void specifyColumn(PreparedStatement statement, int index, LogEvent event) throws SQLException, IllegalStateException
statement
- the prepard statementindex
- the indexevent
- the log eventSQLException
- if an SQL related error occursIllegalStateException
- if the supplied index is out of boundsprotected final String getTable()
protected final ColumnInfo getColumn(int index)
index
- the indexCopyright © 1997–2021. All rights reserved.