public interface SpyLogDelegator
Modifications for log4j2:
connectionOpened(Spy)
into
connectionOpened(Spy, long)
, to accept a parameter execTime
,
defining the time elapsed to open the connection in ms.
This information can be generated when a ConnectionSpy
has been acquired
through the use of DriverSpy
(through a DriverManager
),
see DriverSpy#connect(String, Properties)
.
It cannot be generated when a ConnectionSpy
has been directly instantiated
(by providing an already instantiated Connection
to the constructor
ConnectionSpy(Connection)
; Nevertheless, new constructors for ConnectionSpy
,
accepting the execution time to open the connection, can be used).
connectionClosed(Spy)
into
connectionClosed(Spy, long)
, to accept a parameter execTime
,
defining the time elapsed to close the connection in ms.
This execution time can always be computed by ConnectionSpy#close()
.
Slf4jSpyLogDelegator
has been modified accordingly.
Modifier and Type | Method and Description |
---|---|
void |
connectionAborted(Spy spy,
long execTime)
Called whenever a connection spy is aborted.
|
void |
connectionClosed(Spy spy,
long execTime)
Called whenever a connection spy is closed.
|
void |
connectionOpened(Spy spy,
long execTime)
Called whenever a new connection spy is created.
|
void |
constructorReturned(Spy spy,
String constructionInfo)
Called when a spied upon object is constructed.
|
void |
debug(String msg)
Log a Setup and/or administrative log message for log4jdbc.
|
void |
exceptionOccured(Spy spy,
String methodCall,
Exception e,
String sql,
long execTime)
Called when a spied upon method throws an Exception.
|
boolean |
isJdbcLoggingEnabled()
Determine if any of the jdbc or sql loggers are turned on.
|
boolean |
isResultSetCollectionEnabled()
Determine whether the logger is expecting results sets to be collected
|
boolean |
isResultSetCollectionEnabledWithUnreadValueFillIn()
Determine whether the logger is expecting results sets to be collected
AND any unread result set values read explicitly
|
void |
methodReturned(Spy spy,
String methodCall,
String returnMsg)
Called when spied upon method call returns.
|
void |
resultSetCollected(ResultSetCollector resultSetCollector)
Called whenever result set has been collected.
|
void |
sqlOccurred(Spy spy,
String methodCall,
String sql)
Special call that is called only for JDBC method calls that contain SQL.
|
void |
sqlTimingOccurred(Spy spy,
long execTime,
String methodCall,
String sql)
Similar to sqlOccured, but reported after SQL executes and used to report timing stats on the SQL
|
boolean isJdbcLoggingEnabled()
void exceptionOccured(Spy spy, String methodCall, Exception e, String sql, long execTime)
spy
- the Spy wrapping the class that threw an Exception.methodCall
- a description of the name and call parameters of the method generated the Exception.e
- the Exception that was thrown.sql
- optional sql that occured just before the exception occured.execTime
- optional amount of time that passed before an exception was thrown when sql was being executed.
caller should pass -1 if not usedvoid methodReturned(Spy spy, String methodCall, String returnMsg)
spy
- the Spy wrapping the class that called the method that returned.methodCall
- a description of the name and call parameters of the method that returned.returnMsg
- return value converted to a String for integral types, or String representation for Object
return types this will be null for void return types.void constructorReturned(Spy spy, String constructionInfo)
spy
- the Spy wrapping the class that called the method that returned.constructionInfo
- information about the object constructionvoid sqlOccurred(Spy spy, String methodCall, String sql)
spy
- the Spy wrapping the class where the SQL occurred.methodCall
- a description of the name and call parameters of the method that generated the SQL.sql
- sql that occurred.void sqlTimingOccurred(Spy spy, long execTime, String methodCall, String sql)
spy
- the Spy wrapping the class where the SQL occurred.execTime
- how long it took the sql to run, in msec.methodCall
- a description of the name and call parameters of the method that generated the SQL.sql
- sql that occurred.void connectionOpened(Spy spy, long execTime)
spy
- ConnectionSpy that was created.execTime
- A long
defining the time elapsed to open the connection in ms
(useful information, as a connection might take some time to be opened sometimes).
Caller should pass -1 if not used or unknown.void connectionClosed(Spy spy, long execTime)
spy
- ConnectionSpy
that was closed.execTime
- A long
defining the time elapsed to close the connection in ms
(useful information, as a connection might take some time to be closed sometimes).
Caller should pass -1 if not used or unknown.void connectionAborted(Spy spy, long execTime)
spy
- ConnectionSpy
that was aborted.execTime
- A long
defining the time elapsed to abort the connection in ms
(useful information, as a connection might take some time to be aborted sometimes).
Caller should pass -1 if not used or unknown.void debug(String msg)
msg
- message to log.boolean isResultSetCollectionEnabled()
boolean isResultSetCollectionEnabledWithUnreadValueFillIn()
void resultSetCollected(ResultSetCollector resultSetCollector)
next()
method of the spied ResultSet
return false
meaning that its end is reached.
It will be also called if the ResultSet
is closed.ResultSetSpy
,
DefaultResultSetCollector
Copyright © 2013 Bgee - Swiss Institute of Bioinformatics. All Rights Reserved.