Package org.jdbi.v3.core.statement
Class Slf4JSqlLogger
- java.lang.Object
-
- org.jdbi.v3.core.statement.Slf4JSqlLogger
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Loggerlog-
Fields inherited from interface org.jdbi.v3.core.statement.SqlLogger
NOP_SQL_LOGGER
-
-
Constructor Summary
Constructors Constructor Description Slf4JSqlLogger()Slf4JSqlLogger(org.slf4j.Logger log)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.Stringformat(java.time.Duration duration)private static java.lang.StringgetSql(StatementContext context)voidlogAfterExecution(StatementContext context)Will be called after a query has been executed.voidlogException(StatementContext context, java.sql.SQLException ex)Will be called after a query has failed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jdbi.v3.core.statement.SqlLogger
logBeforeExecution
-
-
-
-
Method Detail
-
logAfterExecution
public void logAfterExecution(StatementContext context)
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
public void logException(StatementContext context, java.sql.SQLException ex)
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
-
getSql
private static java.lang.String getSql(StatementContext context)
-
format
private static java.lang.String format(java.time.Duration duration)
-
-