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 2020/03/09 18:58:55 UTC

[logging-log4j2] branch master updated: Add debugging to status logger.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/master by this push:
     new eddab1f  Add debugging to status logger.
eddab1f is described below

commit eddab1f5cd577ec2f77477c91ad629cb5fedaf99
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Mar 9 14:58:50 2020 -0400

    Add debugging to status logger.
---
 .../logging/log4j/jdbc/appender/JdbcDatabaseManager.java      | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/log4j-jdbc/src/main/java/org/apache/logging/log4j/jdbc/appender/JdbcDatabaseManager.java b/log4j-jdbc/src/main/java/org/apache/logging/log4j/jdbc/appender/JdbcDatabaseManager.java
index ff7baa4..dfad705 100644
--- a/log4j-jdbc/src/main/java/org/apache/logging/log4j/jdbc/appender/JdbcDatabaseManager.java
+++ b/log4j-jdbc/src/main/java/org/apache/logging/log4j/jdbc/appender/JdbcDatabaseManager.java
@@ -779,10 +779,15 @@ public final class JdbcDatabaseManager extends AbstractDatabaseManager {
             }
 
             if (isBuffered() && this.isBatchSupported) {
+                logger().debug("addBatch for {}", this.statement);
                 this.statement.addBatch();
-            } else if (this.statement.executeUpdate() == 0) {
-                throw new AppenderLoggingException(
-                        "No records inserted in database table for log event in JDBC manager [%s].", fieldsToString());
+            } else {
+                final int executeUpdate = this.statement.executeUpdate();
+                logger().debug("executeUpdate = {} for {}", executeUpdate, this.statement);
+                if (executeUpdate == 0) {
+                    throw new AppenderLoggingException(
+                            "No records inserted in database table for log event in JDBC manager [%s].", fieldsToString());
+                }
             }
         } catch (final SQLException e) {
             throw new DbAppenderLoggingException(e, "Failed to insert record for log event in JDBC manager: %s [%s]", e,