public class DefaultJDBCTarget extends AbstractJDBCTarget
| Modifier and Type | Field and Description |
|---|---|
private ColumnInfo[] |
m_columns |
private java.sql.PreparedStatement |
m_statement |
private java.lang.String |
m_table |
| Constructor and Description |
|---|
DefaultJDBCTarget(javax.sql.DataSource dataSource,
java.lang.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.
|
private java.lang.String |
getContextMap(ContextMap map,
java.lang.String aux) |
private java.lang.String |
getStackTrace(java.lang.Throwable throwable) |
protected java.lang.String |
getStatementSQL()
Return the SQL insert statement.
|
protected java.lang.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(java.sql.PreparedStatement statement,
int index,
LogEvent event)
Adds a single object into statement.
|
checkConnection, close, doProcessEvent, getConnection, opengetErrorHandler, isOpen, processEvent, setErrorHandlerprivate final java.lang.String m_table
private final ColumnInfo[] m_columns
private java.sql.PreparedStatement m_statement
public DefaultJDBCTarget(javax.sql.DataSource dataSource,
java.lang.String table,
ColumnInfo[] columns)
dataSource - the JDBC datasourcetable - the tablecolumns - a ColumnInfo arrayprotected void output(LogEvent event)
output in class AbstractJDBCTargetevent - the log event.protected void openConnection()
openConnection in class AbstractJDBCTargetprotected java.lang.String getStatementSQL()
protected boolean isStale()
isStale in class AbstractJDBCTargetprotected void closeConnection()
closeConnection in class AbstractJDBCTargetprotected void specifyColumn(java.sql.PreparedStatement statement,
int index,
LogEvent event)
throws java.sql.SQLException,
java.lang.IllegalStateException
statement - the prepard statementindex - the indexevent - the log eventjava.sql.SQLException - if an SQL related error occursjava.lang.IllegalStateException - if the supplied index is out of boundsprotected final java.lang.String getTable()
protected final ColumnInfo getColumn(int index)
index - the indexprivate java.lang.String getStackTrace(java.lang.Throwable throwable)
private java.lang.String getContextMap(ContextMap map, java.lang.String aux)