Im using jdbi v3 and I recently wanted to add a logger to check my query statements.
Checking the documentation I found this https://jdbi.org/#_sqllogger
Which refers to this class https://jdbi.org/apidocs/org/jdbi/v3/core/statement/Slf4JSqlLogger.html
Unfortunately, I found no records, dependencies, or any information about this class, seems like no longer exist? is it a new dependency that maybe was removed? or should I do something special to include it? Any idea about it?
CodePudding user response:
Make sure you are using the latest version of the Jdbi 3 core JAR (currently that is v3.28.0).
As a Maven dependency:
<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-core</artifactId>
<version>3.28.0</version>
</dependency>
I believe the class was first introduced in v3.19.0.
As an alternative, if you don't want (or are unable) to upgrade, you can create your own class from the org.jdbi.v3.core.statement.SqlLogger
interface.
Something like:
public class MyLogger implements SqlLogger {
@Override
public void logAfterExecution(StatementContext ctx) {
...
ctx.getParsedSql()...;
}
}