diff --git a/src/main/java/com/snowflake/kafka/connector/internal/KCLogger.java b/src/main/java/com/snowflake/kafka/connector/internal/KCLogger.java index 91a9494ab..4db31357a 100644 --- a/src/main/java/com/snowflake/kafka/connector/internal/KCLogger.java +++ b/src/main/java/com/snowflake/kafka/connector/internal/KCLogger.java @@ -95,6 +95,10 @@ public void error(String format, Object... vars) { } } + public boolean isDebugEnabled() { + return logger.isDebugEnabled(); + } + private String getFormattedLogMessage(String format, Object... vars) { if (prependMdcContext) { String connCtx = MDC.get(MDC_CONN_CTX_KEY); diff --git a/src/main/java/com/snowflake/kafka/connector/internal/SnowflakeSinkServiceV1.java b/src/main/java/com/snowflake/kafka/connector/internal/SnowflakeSinkServiceV1.java index 63a0fb205..15a01c93b 100644 --- a/src/main/java/com/snowflake/kafka/connector/internal/SnowflakeSinkServiceV1.java +++ b/src/main/java/com/snowflake/kafka/connector/internal/SnowflakeSinkServiceV1.java @@ -1102,14 +1102,19 @@ private void purge(List files) { private void moveToTableStage(List failedFiles) { if (!failedFiles.isEmpty()) { OffsetContinuityRanges offsets = searchForMissingOffsets(failedFiles); - LOGGER.info( - "Moving failed files for pipe: {} to tableStage failedFileCount: {}, continuousOffsets:" - + " {}, missingOffsets: {}", - pipeName, - failedFiles.size(), - offsets.getContinuousOffsets(), - offsets.getMissingOffsets()); - LOGGER.debug("Moving failed files: {}", failedFiles); + String baseLog = + String.format( + "Moving failed files for pipe: %s to tableStage failedFileCount: %d," + + " continuousOffsets: %s, missingOffsets: %s", + pipeName, + failedFiles.size(), + offsets.getContinuousOffsets(), + offsets.getMissingOffsets()); + if (LOGGER.isDebugEnabled()) { + LOGGER.info("{} - {}", baseLog, failedFiles); + } else { + LOGGER.info(baseLog); + } conn.moveToTableStage(tableName, stageName, failedFiles); } }