[#1529] Factory.batchStore() logs all single statements to DEBUG output.
Find a more accurate log output
This commit is contained in:
parent
f4cd5d4528
commit
535a28f9fd
@ -93,8 +93,13 @@ class BatchStore implements Batch {
|
||||
Settings orig = SettingsTools.clone(work);
|
||||
|
||||
try {
|
||||
|
||||
// Add the QueryCollector to intercept query execution after rendering
|
||||
work.setExecuteListeners(Arrays.asList(QueryCollector.class.getName()));
|
||||
|
||||
// [#1529] Avoid DEBUG logging of single INSERT / UPDATE statements
|
||||
work.setExecuteLogging(false);
|
||||
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
Configuration previous = records[i].internalAPI(AttachableInternal.class).getConfiguration();
|
||||
|
||||
@ -127,6 +132,7 @@ class BatchStore implements Batch {
|
||||
// Restore the original factory
|
||||
finally {
|
||||
work.setExecuteListeners(orig.getExecuteListeners());
|
||||
work.setExecuteLogging(orig.isExecuteLogging());
|
||||
}
|
||||
|
||||
// Execute one batch statement for each identical SQL statement. Every
|
||||
|
||||
@ -37,6 +37,7 @@ package org.jooq.tools;
|
||||
|
||||
import org.jooq.ExecuteContext;
|
||||
import org.jooq.ExecuteListener;
|
||||
import org.jooq.ExecuteType;
|
||||
import org.jooq.impl.DefaultExecuteListener;
|
||||
|
||||
/**
|
||||
@ -65,7 +66,14 @@ public class LoggerListener extends DefaultExecuteListener {
|
||||
}
|
||||
}
|
||||
else if (!StringUtils.isBlank(ctx.sql())) {
|
||||
log.debug("Executing query", ctx.sql());
|
||||
|
||||
// [#1529] Batch queries should be logged specially
|
||||
if (ctx.type() == ExecuteType.BATCH) {
|
||||
log.debug("Executing batch query", ctx.sql());
|
||||
}
|
||||
else {
|
||||
log.debug("Executing query", ctx.sql());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user