[LOG4J2-2667] "Values not bound to statement" when using JDBC appender,
appender does not respect bufferSize="0".
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java
index 9d3d870..1a279d0 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java
@@ -546,7 +546,7 @@
final boolean closed = true;
try {
if (this.connection != null && !this.connection.isClosed()) {
- if (this.isBatchSupported && this.statement != null) {
+ if (isBuffered() && this.isBatchSupported && this.statement != null) {
logger().debug("Executing batch PreparedStatement {}", this.statement);
int[] result;
try {
@@ -849,7 +849,7 @@
}
}
- if (this.isBatchSupported) {
+ if (isBuffered() && this.isBatchSupported) {
this.statement.addBatch();
} else if (this.statement.executeUpdate() == 0) {
throw new AppenderLoggingException(
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 41d45a2..46a341a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -61,6 +61,9 @@
<action issue="LOG4J2-2660" dev="ggregory" type="update">
Retry when JDBC throws a java.sql.SQLTransactionRollbackException in commitAndClose().
</action>
+ <action issue="LOG4J2-2667" dev="ggregory" type="fix" due-to="Gary Gregory, Edith Chui">
+ "Values not bound to statement" when using JDBC appender, appender does not respect bufferSize="0".
+ </action>
</release>
<release version="2.12.0" date="2019-06-23" description="GA Release 2.12.0">
<action issue="LOG4J2-2547" dev="rgoers" type="fix">