Skip to content

Enhance DualLogger to fan out throwables to log hooks - #249

Merged
jogrogan merged 1 commit into
mainfrom
jogrogan/enhanceLogging
Sep 4, 2026
Merged

jogrogan merged 1 commit into
mainfrom
jogrogan/enhanceLogging

Conversation

@jogrogan

@jogrogan jogrogan commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

What

DualLogger fans each message out to both an SLF4J logger and a list of log hooks (surfaced to hook consumers such as the CLI/UI deploy log). It only exposed info(), and its hook fan-out dropped any Throwable argument. As a result, the DDL deploy/delete failure paths logged at info without the exception, so hook consumers never saw the cause of a failure.

Changes

  • DualLogger: extracted a shared fanOut() helper and added trace/debug/warn/error alongside info, all Throwable-aware. When the trailing argument is a Throwable, SLF4J logs it with a stack trace and the throwable detail is appended to the hook text (falling back to toString() when the throwable message is null).
  • HoptimatorDdlExecutor / HoptimatorDdlUtils: the 8 deploy/delete failure catch blocks now log at warn and pass the caught exception, so the cause reaches the hooks.
  • DualLoggerTest: exhaustive coverage — parameterized across all five levels, plus the full argument-count x throwable matrix (too many / not enough / exact args, with and without a trailing throwable, and corner cases such as a throwable as the sole argument with/without a placeholder, null-message fallback, and a non-trailing throwable treated as a normal parameter).

Testing

./gradlew :hoptimator-jdbc:test — all pass (41 DualLoggerTest cases, 0 failures).

DualLogger only exposed info(), and its message fan-out to log hooks
dropped any Throwable argument. Deploy/delete failure paths logged at
info without the exception, so hook consumers (e.g. the CLI/UI deploy
log) never saw the cause.

- Extract a shared fanOut() helper and add trace/debug/warn/error
  alongside info, all Throwable-aware. When the trailing argument is a
  Throwable, slf4j logs the stack trace and the throwable detail is
  appended to the hook text (falling back to toString() when the
  message is null).
- Log the exception at the DDL deploy/delete failure sites in
  HoptimatorDdlExecutor and HoptimatorDdlUtils, switching them from
  info to warn and passing the caught exception.
- Add exhaustive DualLoggerTest coverage across all levels and the full
  argument-count x throwable matrix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Code Coverage

Overall Project 84.77% -0.09% 🟢
Files changed 80.84% 🟢

File Coverage
DualLogger.java 100% 🟢
HoptimatorDdlUtils.java 86.92% -1.12%
HoptimatorDdlExecutor.java 85.66% -0.92% 🟢

@jogrogan
jogrogan merged commit 146abb1 into main Sep 4, 2026
1 check passed
@jogrogan
jogrogan deleted the jogrogan/enhanceLogging branch September 4, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants