连接日志记录
适用于 ✅ 开源版 ✅ 专业版 ✅ 企业版
除了在 jOOQ 级别记录日志之外,还可以使用 org.jooq.tools.jdbc.LoggingConnection 在 JDBC 级别记录日志。此连接充当 JDBC 代理,拦截所有相关调用,以便将相关信息以 DEBUG 级别记录到 slfj4 或 java.util.logging。
try (Connection logging = new LoggingConnection(datasource.getConnection())) {
// Run statements directly with JDBC
try (Statement s = c.createStatement()) {
s.executeUpdate("INSERT INTO author (id, first_name, last_name) VALUES (3, 'William', 'Shakespeare')";
}
// ... or wrap the connection with jOOQ
DSL.using(logging, dialect)
.insertInto(AUTHOR)
.columns(AUTHOR.ID, AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME)
.values(3, "William", "Shakespeare")
.execute();
}
反馈
您对此页面有任何反馈吗? 我们很乐意听到您的反馈!