Skip to content

Commit

Permalink
Improve logger debug logs (#39)
Browse files Browse the repository at this point in the history
1) Add configuration parameters info to the initilization logs
2) Change rollover eligibility checks logs to info – they will be performed quite rarely, but helpful for debugging
  • Loading branch information
frsv authored Jun 20, 2023
1 parent 664e753 commit 0dd8a2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void maybeRolloverWriter() {
loggerId,
ISO_LOCAL_DATE_TIME.format(rolloverTime.atOffset(ZoneOffset.UTC)));
} else {
LOG.debug(
LOG.info(
"Performed rollover check for logger ID '{}'. Expected rollover time is '{}'",
loggerId,
ISO_LOCAL_DATE_TIME.format(rolloverTime.atOffset(ZoneOffset.UTC)));
Expand All @@ -143,6 +143,10 @@ public void close() {
currentWriter = null;
}

public Duration getRolloverInterval() {
return rolloverInterval;
}

/**
* Creates new writer for the current date. Each new invocation increments the {@code
* logFileCount}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ protected EventLogger(HiveConf conf, Clock clock) {
TimeUnit.MILLISECONDS);

LOG.info(
"Logger successfully started, waiting for query events. Log directory is '{}'", baseDir);
"Logger successfully started, waiting for query events. Log directory is '{}'; rollover"
+ " interval is '{}' minutes; rollover eligibility check is '{}' minutes",
baseDir,
recordsWriterFactory.getRolloverInterval().toMinutes(),
Duration.ofMillis(rolloverEligibilityIntervalMilliseconds).toMinutes());
}

public void handle(HookContext hookContext) {
Expand Down

0 comments on commit 0dd8a2c

Please sign in to comment.