public interface SqlLogger
Configurable.define(String, Object)) and bound Arguments (see SqlStatement.bind(String, Object)) are available on the StatementContext, along with timing information using Instants. It's recommendable to use ChronoUnit.between(java.time.temporal.Temporal, java.time.temporal.Temporal) to measure elapsed time in your unit of choice, as in StatementContext.getElapsedTime(java.time.temporal.ChronoUnit).
Note that if you bind an Argument instance directly, it must implement Object.toString() if you want to be able to log it in any meaningful way. You can also implement log censorship that way, e.g. to hide sensitive content like passwords.| Modifier and Type | Field and Description |
|---|---|
static SqlLogger |
NOP_SQL_LOGGER |
| Modifier and Type | Method and Description |
|---|---|
default void |
logAfterExecution(StatementContext context)
Will be called after a query has been executed.
|
default void |
logBeforeExecution(StatementContext context)
Will be called before a query is executed.
|
default void |
logException(StatementContext context,
SQLException ex)
Will be called after a query has failed.
|
static final SqlLogger NOP_SQL_LOGGER
default void logAfterExecution(StatementContext context)
StatementContext will contain a start StatementContext.getExecutionMoment() and end StatementContext.getCompletionMoment() time.context - the statement contextdefault void logBeforeExecution(StatementContext context)
StatementContext yet.context - the statement contextdefault void logException(StatementContext context, SQLException ex)
StatementContext will contain a start StatementContext.getExecutionMoment() and failure StatementContext.getExceptionMoment() time.context - the statement contextex - the exceptionCopyright © 2019. All rights reserved.