Package org.jdbi.v3.core.statement
Class Slf4JSqlLogger
java.lang.Object
org.jdbi.v3.core.statement.Slf4JSqlLogger
- All Implemented Interfaces:
SqlLogger
Simple
SqlLogger that emits some diagnostic information about
Jdbi usage. Usually you shouldn't log every database statement made but
it can be helpful for debugging.-
Field Summary
Fields inherited from interface org.jdbi.v3.core.statement.SqlLogger
NOP_SQL_LOGGER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidlogAfterExecution(StatementContext context) Will be called after a query has been executed.voidlogException(StatementContext context, SQLException ex) Will be called after a query has failed.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jdbi.v3.core.statement.SqlLogger
logBeforeExecution
-
Constructor Details
-
Slf4JSqlLogger
public Slf4JSqlLogger() -
Slf4JSqlLogger
public Slf4JSqlLogger(org.slf4j.Logger log)
-
-
Method Details
-
logAfterExecution
Description copied from interface:SqlLoggerWill be called after a query has been executed. TheStatementContextwill contain a startStatementContext.getExecutionMoment()and endStatementContext.getCompletionMoment()time.- Specified by:
logAfterExecutionin interfaceSqlLogger- Parameters:
context- the statement context
-
logException
Description copied from interface:SqlLoggerWill be called after a query has failed. TheStatementContextwill contain a startStatementContext.getExecutionMoment()and failureStatementContext.getExceptionMoment()time.- Specified by:
logExceptionin interfaceSqlLogger- Parameters:
context- the statement contextex- the exception
-