public class Slf4jSpyLogDelegator extends Object implements 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 new method simply delegates
to the formerly existing method, now private, so that the behavior of the slf4j logger is not modified.
See SpyLogDelegator for more details.
connectionClosed(Spy) into
connectionClosed(Spy, long), to accept a parameter execTime,
defining the time elapsed to open the connection in ms. This new method simply delegates
to the formerly existing method, now private, so that the behavior of the slf4j logger is not modified.
See SpyLogDelegator for more details.
| Constructor and Description |
|---|
Slf4jSpyLogDelegator()
Create a SpyLogDelegator specific to the Simple Logging Facade for Java (slf4j).
|
| 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 5 log4jdbc spy loggers are turned on (jdbc.audit | jdbc.resultset |
jdbc.sqlonly | jdbc.sqltiming | jdbc.connection)
|
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)
Special call that is called only for JDBC method calls that contain SQL.
|
public Slf4jSpyLogDelegator()
public boolean isJdbcLoggingEnabled()
isJdbcLoggingEnabled in interface SpyLogDelegatorpublic void exceptionOccured(Spy spy, String methodCall, Exception e, String sql, long execTime)
SpyLogDelegatorexceptionOccured in interface SpyLogDelegatorspy - 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 usedpublic void methodReturned(Spy spy, String methodCall, String returnMsg)
SpyLogDelegatormethodReturned in interface SpyLogDelegatorspy - 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.public void constructorReturned(Spy spy, String constructionInfo)
SpyLogDelegatorconstructorReturned in interface SpyLogDelegatorspy - the Spy wrapping the class that called the method that returned.constructionInfo - information about the object constructionpublic void sqlOccurred(Spy spy, String methodCall, String sql)
SpyLogDelegatorsqlOccurred in interface SpyLogDelegatorspy - 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.public void sqlTimingOccurred(Spy spy, long execTime, String methodCall, String sql)
sqlTimingOccurred in interface SpyLogDelegatorspy - the Spy wrapping the class where the SQL occurred.execTime - how long it took the SQL to run, in milliseconds.methodCall - a description of the name and call parameters of the
method that generated the SQL.sql - SQL that occurred.public void debug(String msg)
SpyLogDelegatordebug in interface SpyLogDelegatormsg - message to log.public void connectionOpened(Spy spy, long execTime)
SpyLogDelegatorconnectionOpened in interface SpyLogDelegatorspy - 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.public void connectionClosed(Spy spy, long execTime)
SpyLogDelegatorconnectionClosed in interface SpyLogDelegatorspy - 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.public void connectionAborted(Spy spy, long execTime)
SpyLogDelegatorconnectionAborted in interface SpyLogDelegatorspy - 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.public boolean isResultSetCollectionEnabled()
SpyLogDelegatorisResultSetCollectionEnabled in interface SpyLogDelegatorpublic boolean isResultSetCollectionEnabledWithUnreadValueFillIn()
SpyLogDelegatorisResultSetCollectionEnabledWithUnreadValueFillIn in interface SpyLogDelegatorpublic void resultSetCollected(ResultSetCollector resultSetCollector)
SpyLogDelegatornext() method of the spied ResultSet
return false meaning that its end is reached.
It will be also called if the ResultSet is closed.resultSetCollected in interface SpyLogDelegatorResultSetSpy,
DefaultResultSetCollectorCopyright © 2013 Bgee - Swiss Institute of Bioinformatics. All Rights Reserved.