ErrorAware
, LogTarget
, Closeable
DefaultJDBCTarget
public abstract class AbstractJDBCTarget extends AbstractTarget
Modifier and Type | Field | Description |
---|---|---|
private java.sql.Connection |
m_connection |
|
private javax.sql.DataSource |
m_dataSource |
Modifier | Constructor | Description |
---|---|---|
protected |
AbstractJDBCTarget(javax.sql.DataSource dataSource) |
Creation of a new instance of the AbstractJDBCTarget.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
checkConnection() |
Utility method to check connection and bring it back up if necessary.
|
void |
close() |
Shutdown target.
|
protected void |
closeConnection() |
Close connection to underlying database.
|
protected void |
doProcessEvent(LogEvent event) |
Process a log event, via formatting and outputting it.
|
protected java.sql.Connection |
getConnection() |
Utility method for subclasses to access connection.
|
protected boolean |
isStale() |
Detect if connection is stale and should be reopened.
|
protected void |
open() |
Startup log session.
|
protected void |
openConnection() |
Open connection to underlying database.
|
protected abstract void |
output(LogEvent event) |
Output a log event to DB.
|
getErrorHandler, isOpen, processEvent, setErrorHandler
private javax.sql.DataSource m_dataSource
private java.sql.Connection m_connection
protected AbstractJDBCTarget(javax.sql.DataSource dataSource)
dataSource
- the JDBC datasourceprotected void doProcessEvent(LogEvent event) throws java.lang.Exception
doProcessEvent
in class AbstractTarget
event
- the log eventjava.lang.Exception
- if an event processing error occursprotected abstract void output(LogEvent event)
event
- the log event.protected void open()
open
in class AbstractTarget
protected void openConnection()
protected final java.sql.Connection getConnection()
protected final void checkConnection()
protected boolean isStale()
public void close()
close
in interface Closeable
close
in class AbstractTarget
protected void closeConnection()
Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.