[jOOQ/jOOQ#9506] Mute LoggerListener::exception in some cases

This commit is contained in:
Lukas Eder 2023-06-15 08:46:56 +02:00
parent 7177c64c9d
commit f575623ecf
2 changed files with 9 additions and 2 deletions

View File

@ -426,7 +426,11 @@ final class MigrationImpl extends AbstractScope implements Migration {
// [#8301] Find a better way to test if our table already exists
try {
historyCtx.fetchExists(HISTORY);
Configuration c = historyCtx
.configuration()
.derive();
c.data("org.jooq.tools.LoggerListener.exception.mute", true);
c.dsl().fetchExists(HISTORY);
return true;
}
catch (DataAccessException ignore) {}

View File

@ -236,7 +236,10 @@ public class LoggerListener implements ExecuteListener {
@Override
public void exception(ExecuteContext ctx) {
if (log.isDebugEnabled())
// [#9506] An internal, undocumented flag that allows for muting exception logging of
// "expected" exceptions.
if (log.isDebugEnabled() && ctx.configuration().data("org.jooq.tools.LoggerListener.exception.mute") == null)
log.debug("Exception", ctx.exception());
}