You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2019/08/06 21:54:07 UTC
[logging-log4j2] branch release-2.x updated: [LOG4J2-2667] "Values
not bound to statement" when using JDBC appender,
appender does not respect bufferSize="0".
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/release-2.x by this push:
new 7972089 [LOG4J2-2667] "Values not bound to statement" when using JDBC appender, appender does not respect bufferSize="0".
7972089 is described below
commit 7972089ad01a30568b2467581abac6f3cb70b769
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Aug 6 17:53:59 2019 -0400
[LOG4J2-2667] "Values not bound to statement" when using JDBC appender,
appender does not respect bufferSize="0".
---
.../logging/log4j/core/appender/db/jdbc/JdbcDatabaseManager.java | 4 ++--
src/changes/changes.xml | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
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 @@ public final class JdbcDatabaseManager extends AbstractDatabaseManager {
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 @@ public final class JdbcDatabaseManager extends AbstractDatabaseManager {
}
}
- 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">