Skip to content

Commit

Permalink
One log to rule them all
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mbobowski committed Dec 11, 2024
1 parent 6d19b6b commit 23c8585
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1102,14 +1102,19 @@ private void purge(List<String> files) {
private void moveToTableStage(List<String> 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);
}
}
Expand Down

0 comments on commit 23c8585

Please sign in to comment.