getindata / flink-http-connector

Http Connector for Apache Flink. Provides sources and sinks for Datastream , Table and SQL APIs.
Apache License 2.0
150 stars 42 forks source link

Logging code at DEBUG level in JavaNetHttpPollingClient wrongly displays the status code and response body values. #96

Closed AdrianVasiliu closed 4 months ago

AdrianVasiliu commented 4 months ago

If the log level is configured at DEBUG (or TRACE) level, a bug in the logging code here: https://github.com/getindata/flink-http-connector/blob/328bf2e0c3c8f7e0702da08271434ec6429e43c8/src/main/java/com/getindata/connectors/http/internal/table/lookup/JavaNetHttpPollingClient.java#L100-L101 prevents the log to show the values of statusCode and responseBody.

Instead, the log contains:

Received status code [%s] for RestTableSource request with Server response body [%s]

How to reproduce: Execute any Flink job using the connector, with rootLogger.level = DEBUG in the log config. Or, in the connector repo:

  1. Set the DEBUG level in https://github.com/getindata/flink-http-connector/blob/main/src/test/resources/log4j2-test.properties#L19
  2. mvn clean test -Dtest=JavaNetHttpPollingClientConnectionTest

=> the log contains:

Received status code [%s] for RestTableSource request with Server response body [%s]

while it should contain:

Received status code [201] for RestTableSource request with Server response body [{
  "id": "COUNTER", [...] ]

The issue is minor, as it only affects the logs, and this only at debug level. However, the debug logs are meant to help debugging... so there's value in fixing it.

AdrianVasiliu commented 4 months ago

I prepare a tiny PR to fix it. You can assign the issue to me.