| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectorg.apache.log.output.AbstractTargetorg.apache.log.output.db.AbstractJDBCTargetorg.apache.log.output.db.DefaultJDBCTargetpublic class DefaultJDBCTargetextends AbstractJDBCTargetField Summary | |
private ColumnInfo[] | |
private PreparedStatement | |
private String | |
Fields inherited from class org.apache.log.output.db.AbstractJDBCTarget | |
m_connection, m_dataSource | |
Fields inherited from class org.apache.log.output.AbstractTarget | |
DEFAULT_ERROR_HANDLER, m_errorHandler, m_isOpen | |
Constructor Summary | |
| |
Method Summary | |
protected void |
|
protected ColumnInfo |
|
private String |
|
private String |
|
protected String |
|
protected String |
|
protected boolean |
|
protected void |
|
protected void | |
protected void |
|
Methods inherited from class org.apache.log.output.db.AbstractJDBCTarget | |
checkConnection, close, closeConnection, doProcessEvent, getConnection, isStale, open, openConnection, output | |
Methods inherited from class org.apache.log.output.AbstractTarget | |
close, doProcessEvent, getErrorHandler, isOpen, open, processEvent, setErrorHandler | |
public DefaultJDBCTarget(DataSource dataSource,
String table,
ColumnInfo[] columns)Creation of a new JDBC logging target.
- Parameters:
dataSource- the JDBC datasourcetable- the tablecolumns- a ColumnInfo array
protected void closeConnection()
Close connection to underlying database.
- Overrides:
- closeConnection in interface AbstractJDBCTarget
protected final ColumnInfo getColumn(int index)
Return the column info for an supplied index.
- Parameters:
index- the index
- Returns:
- the column info
private String getStackTrace(Throwable throwable)
protected String getStatementSQL()
Return the SQL insert statement.
- Returns:
- the statement
protected final String getTable()
Return the underlying table
- Returns:
- the table name
protected boolean isStale()
Test if the target is stale.
- Overrides:
- isStale in interface AbstractJDBCTarget
- Returns:
- TRUE if the target is stale else FALSE
protected void openConnection()
Open connection to underlying database.
- Overrides:
- openConnection in interface AbstractJDBCTarget
protected void output(LogEvent event)
Output a log event to DB. This must be implemented by subclasses.
- Overrides:
- output in interface AbstractJDBCTarget
- Parameters:
event- the log event.
protected void specifyColumn(PreparedStatement statement,
int index,
LogEvent event)
throws SQLException,
IllegalStateExceptionAdds a single object into statement.
- Parameters:
statement- the prepard statementindex- the indexevent- the log event