Skip to content

isthmus: PostgreSqlIntegrationTest logs SQL with printf specifiers, so SLF4J discards it #1258

Description

@nielspardon

PostgreSqlIntegrationTest logs the two SQL statements a result mismatch would be diagnosed from, using printf specifiers:

LOG.atDebug().log("Reference SQL:\n%s", referenceSql);
LOG.atDebug().log("Generated SQL:\n%s", generatedSql);

SLF4J substitutes {} anchors, not printf conversions, so the specifier is emitted verbatim and the argument is discarded — no exception, no warning. Against the pinned pair (slf4j 2.0.18 plus slf4j-jdk14, gradle/libs.versions.toml):

L.atInfo().log("PCT   Reference SQL:\n%s", "SELECT 1")   ->  INFO: PCT   Reference SQL:\n%s
L.atInfo().log("BRACE Reference SQL:\n{}", "SELECT 1")   ->  INFO: BRACE Reference SQL:\nSELECT 1

So anyone enabling debug logging to diff a TPC-H reference against the generated query gets two lines reading literally Reference SQL: and %s. InvalidLogMessageFormat does not catch it — it does not model the fluent atLevel().log(...) builder, and it counts %s as a placeholder, so one specifier plus one argument reads as matching.

The fix is {} in both lines. These are the only two logging calls in the repo that mix printf specifiers into a logging call; there is no inverse case of {} inside a String.format. The class is @Tag("integration") and excluded from :isthmus:test, so this only affects the separate integrationTest task, which is why it went unnoticed.

Measured on main at 944b921.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingisthmus

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions