Skip to content

Badly formatted status msg in AbstractDriverManagerConnectionSource #3828

@ppkarwasz

Description

@ppkarwasz

Discussed in #3827

Originally posted by RichMacDonald July 15, 2025
Version 2.24.3 org.apache.logging.log4j.core.appender.db.jdbc.AbstractDriverManagerConnectionSource line 162 has a method

        LOGGER.debug(
                "{} acquired connection for '{}': {} ({}{@})",
                getClass().getSimpleName(),
                actualConnectionString,
                connection,
                connection.getClass().getName(),
                Integer.toHexString(connection.hashCode()));

That eventually causes org.apache.logging.log4j.message.ParameterFormatter line 252 to trigger:

                STATUS_LOGGER.warn(
                        "found {} argument placeholders, but provided {} for pattern `{}`",
                        analysis.placeholderCount,
                        argCount,
                        pattern);
Log4j2-TF-12-AsyncLoggerConfig-8 WARN found 4 argument placeholders, but provided 5 for pattern `{} acquired connection for '{}': {} ({}{@})`

In practice, this makes logging to JDBC impractical unless status logging level is set to ERROR. Note that the code is the same in the latest (as of today) release of version 2.

Log4j version 3 has refactored the classes so I don't know if the issue persists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect, unexpected, or unintended behavior of existing code

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions