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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
logAfterExecution
(StatementContext context) Will be called after a query has been executed.void
logException
(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, wait
Methods 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:SqlLogger
Will be called after a query has been executed. TheStatementContext
will contain a startStatementContext.getExecutionMoment()
and endStatementContext.getCompletionMoment()
time.- Specified by:
logAfterExecution
in interfaceSqlLogger
- Parameters:
context
- the statement context
-
logException
Description copied from interface:SqlLogger
Will be called after a query has failed. TheStatementContext
will contain a startStatementContext.getExecutionMoment()
and failureStatementContext.getExceptionMoment()
time.- Specified by:
logException
in interfaceSqlLogger
- Parameters:
context
- the statement contextex
- the exception
-