public class DataSourceSpy extends Object implements DataSource, Spy
You can get log4jdbc to work on this using the following config changes
| Constructor and Description |
|---|
DataSourceSpy(DataSource realDataSource)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
getClassType()
Get the type of class being spied upon.
|
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
Integer |
getConnectionNumber()
Get the connection number.
|
SpyLogDelegator |
getLogDelegator()
Get the
SpyLogDelegator that are used by all resources
obtained starting from this DataSource
(Connections, ResultSets, ...). |
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
protected void |
reportException(String methodCall,
SQLException exception)
Report to the logger all exceptions which have to be reported by this class
|
void |
setLogDelegator(SpyLogDelegator spyLogDelegator)
Set a custom
SpyLogDelegator to be used by all resources
provided by this DataSource, rather than the default
SpyLogDelegator returned by
SpyLogFactory#getSpyLogDelegator(). |
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetParentLoggerisWrapperFor, unwrappublic DataSourceSpy(DataSource realDataSource)
realDataSource - the real DataSourcepublic SpyLogDelegator getLogDelegator()
SpyLogDelegator that are used by all resources
obtained starting from this DataSource
(Connections, ResultSets, ...).SpyLogDelegator currently used
by this DataSource.public void setLogDelegator(SpyLogDelegator spyLogDelegator)
SpyLogDelegator to be used by all resources
provided by this DataSource, rather than the default
SpyLogDelegator returned by
SpyLogFactory#getSpyLogDelegator().spyLogDelegator - The SpyLogDelegator to be used by all resources
obtained starting from this DataSource
(Connections, ResultSets, ...).protected void reportException(String methodCall, SQLException exception)
methodCall - the method which threw an exceptionexception - the thrown exceptionpublic Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic Connection getConnection(String username, String password) throws SQLException
getConnection in interface DataSourceSQLExceptionpublic int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourceSQLExceptionpublic PrintWriter getLogWriter() throws SQLException
getLogWriter in interface CommonDataSourceSQLExceptionpublic void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface CommonDataSourceSQLExceptionpublic void setLogWriter(PrintWriter out) throws SQLException
setLogWriter in interface CommonDataSourceSQLExceptionpublic String getClassType()
SpygetClassType in interface Spypublic Integer getConnectionNumber()
SpygetConnectionNumber in interface SpyCopyright © 2013 Bgee - Swiss Institute of Bioinformatics. All Rights Reserved.