net.sf.log4jdbc
Interface SpyLogDelegator

All Known Implementing Classes:
SQLInterceptorSpyLogDelegator

public interface SpyLogDelegator

Delegates Spy events to a logger. This interface is used for all logging activity used by log4jdbc and hides the specific implementation of any given logging system from log4jdbc.

Author:
Arthur Blake

Method Summary
 void connectionClosed(Spy spy)
          Called whenever a connection spy is closed.
 void connectionOpened(Spy spy)
          Called whenever a new connection spy is created.
 void constructorReturned(Spy spy, java.lang.String constructionInfo)
          Called when a spied upon object is constructed.
 void debug(java.lang.String msg)
          Log a Setup and/or administrative log message for log4jdbc.
 void exceptionOccured(Spy spy, java.lang.String methodCall, java.lang.Exception e, java.lang.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.
 void methodReturned(Spy spy, java.lang.String methodCall, java.lang.String returnMsg)
          Called when spied upon method call returns.
 void sqlOccured(Spy spy, java.lang.String methodCall, java.lang.String sql)
          Special call that is called only for JDBC method calls that contain SQL.
 void sqlTimingOccured(Spy spy, long execTime, java.lang.String methodCall, java.lang.String sql)
          Similar to sqlOccured, but reported after SQL executes and used to report timing stats on the SQL
 

Method Detail

isJdbcLoggingEnabled

boolean isJdbcLoggingEnabled()
Determine if any of the jdbc or sql loggers are turned on.

Returns:
true if any of the jdbc or sql loggers are enabled at error level or higher.

exceptionOccured

void exceptionOccured(Spy spy,
                      java.lang.String methodCall,
                      java.lang.Exception e,
                      java.lang.String sql,
                      long execTime)
Called when a spied upon method throws an Exception.

Parameters:
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 used

methodReturned

void methodReturned(Spy spy,
                    java.lang.String methodCall,
                    java.lang.String returnMsg)
Called when spied upon method call returns.

Parameters:
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.

constructorReturned

void constructorReturned(Spy spy,
                         java.lang.String constructionInfo)
Called when a spied upon object is constructed.

Parameters:
spy - the Spy wrapping the class that called the method that returned.
constructionInfo - information about the object construction

sqlOccured

void sqlOccured(Spy spy,
                java.lang.String methodCall,
                java.lang.String sql)
Special call that is called only for JDBC method calls that contain SQL.

Parameters:
spy - the Spy wrapping the class where the SQL occured.
methodCall - a description of the name and call parameters of the method that generated the SQL.
sql - sql that occured.

sqlTimingOccured

void sqlTimingOccured(Spy spy,
                      long execTime,
                      java.lang.String methodCall,
                      java.lang.String sql)
Similar to sqlOccured, but reported after SQL executes and used to report timing stats on the SQL

Parameters:
spy - the Spy wrapping the class where the SQL occured.
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 occured.

connectionOpened

void connectionOpened(Spy spy)
Called whenever a new connection spy is created.

Parameters:
spy - ConnectionSpy that was created.

connectionClosed

void connectionClosed(Spy spy)
Called whenever a connection spy is closed.

Parameters:
spy - ConnectionSpy that was closed.

debug

void debug(java.lang.String msg)
Log a Setup and/or administrative log message for log4jdbc.

Parameters:
msg - message to log.