Skip to content

[jdbc-v2,client-v2] Fix bad logging #2970

Description

@chernser

Description

After review next issues with logging should be resolved:
Bad Logging

  • ClickHouseSqlParser.jj:97-102 — parse failures log the complete user SQL at WARN. This can expose passwords/PII and spam under repeated unsupported SQL. Remove SQL or use a truncated/hash identifier at DEBUG.
  • DatabaseMetaDataImpl.java:1126-1141,1335-1351 — metadata mutators log ERROR per unknown type row while successfully falling back to JDBCType.OTHER. Warn once per distinct type or use DEBUG.
  • ExceptionUtils.java:52-53 — every JDBC exception conversion produces a DEBUG stack trace, frequently including full SQL from ResultSetImpl. This amplifies per-cell conversion failures. Should be removed.
  • PreparedStatementImpl.java:750-751 — recursive parameter encoding logs every array, collection and map element at TRACE, potentially including sensitive values.
  • StatementImpl.java:80-85,174-175,258-259 — each execution can log the same SQL up to three times at TRACE.
  • HttpAPIClientHelper.java:734-741 plus Client.java:1502,1708,1852 — one connection failure is logged by transport and then again with a stack as “Retrying.” Quarantine may add another WARN. Consolidate into one retry log containing operation, attempt, endpoint and query ID.
  • HttpAPIClientHelper.java:921-941 — two DEBUG messages per HTTP operation. Compression settings are already logged at client initialization.
  • ClickHouseLZ4InputStream.java:138-140 — DEBUG is inside decompression refill, although emission is limited to buffer growth events.
  • ClickHouseLZ4InputStream.java:138-140 — DEBUG is inside decompression refill, although emission is limited to buffer growth events.

Useless

  • Driver.java:65 "Initializing ClickHouse JDBC driver V2" and :68 the driver version — a static-init banner; the version is already reachable through the JDBC API.
  • ConnectionImpl.java:100 "Framework detection is disabled." — announces that a feature did nothing, on every connection.
  • ClickHouseLZ4InputStream.java:30 / ClickHouseLZ4OutputStream.java:32 "Using decompressor {}" / "Using compressor {}" — these print an object identity like LZ4Compressor@1a2b3c, not the algorithm or buffer size, so they confirm a positive event and the value is unusable. Should be more informative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions