Skip to content

Refine solver logging and performance log routing for CBC/XA#246

Merged
dwr-bli merged 3 commits into
mainfrom
feature/solver-logging-refactor
May 1, 2026
Merged

Refine solver logging and performance log routing for CBC/XA#246
dwr-bli merged 3 commits into
mainfrom
feature/solver-logging-refactor

Conversation

@dwr-bli

@dwr-bli dwr-bli commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Summary
This PR narrows the scope to solver logging and performance observability only.

It updates the CBC/XA logging flow and aligns performance log routing across:

  • CbcSolver.java
  • XASolver.java
  • PerformanceTimer.java
  • log4j2.xml

Main updates

  • Refine CBC solver logging to use more structured/fluent logger calls.
  • Add XA solver lifecycle/performance summary logging for better run visibility.
  • Update PerformanceTimer so performance events are routed by solver namespace.
  • Update log4j2.xml to support separate CBC/XA detailed logs and separate perf logs.

Scope / Intent
This PR is intentionally limited to logging, observability, and log routing.
It is not intended to change:

  • model construction
  • solve sequence / fallback order
  • tolerance behavior
  • warm-start behavior
  • numerical results
  • solver business logic

Feedback addressed
This version was reduced and adjusted based on earlier review comments, with the goal of keeping the PR focused and low-risk:

  • Scope kept to logging/observability only; no tolerant-mode or solver behavior work is included.
  • Logging levels were tightened so detailed/internal messages are not broadly exposed as new INFO console output unless they are useful operational lifecycle messages.
  • Performance summary logging was simplified toward single structured log entries instead of many separate logging calls.
  • MDC-based context handling was not expanded further, to avoid large method reshaping and unnecessary structural churn.
  • No extra refactoring was added beyond what was needed for logging/perf routing.
  • Diff was kept as narrow as possible around the four files above.
  • Message wording was kept more operational and less tied to internal terminology where possible.
  • The update preserves existing solver behavior and focuses on observability only.

Design notes

  • PerformanceTimer now matches the current log4j2 solver-specific perf routing design.
  • log4j2.xml now provides separate detailed/perf log destinations for CBC and XA.
  • XA observability additions are intended to make run timing and summary diagnostics easier without altering the XA solve flow.
  • CBC logging cleanup is intended to reduce noise and improve consistency, not to redesign the solver.

@dwr-zroy dwr-zroy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested:

  • Additional changes to the use of INFO. See comments.
  • Use of private class in XASolver discouraged, it needs to be unit-tested at least.
  • Request for class name change (feel free to ignore if you disagree)
  • Misc.

Comment thread wrims-core/src/main/resources/log4j2.xml
Comment thread wrims-core/src/main/java/gov/ca/water/wrims/engine/core/solver/CbcSolver.java Outdated
Comment thread wrims-core/src/main/java/gov/ca/water/wrims/engine/core/solver/CbcSolver.java Outdated
Comment thread wrims-core/src/main/java/gov/ca/water/wrims/engine/core/solver/CbcSolver.java Outdated
Comment thread wrims-core/src/main/resources/log4j2.xml
Comment thread wrims-core/src/main/java/gov/ca/water/wrims/engine/core/solver/XASolver.java Outdated
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.8% Coverage on New Code (required ≥ 80%)
4.5% Duplication on New Code (required ≤ 3%)
C Maintainability Rating on New Code (required ≥ A)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@dwr-zroy dwr-zroy force-pushed the feature/solver-logging-refactor branch from 66657b9 to c2b52b8 Compare May 1, 2026 16:17

@dwr-zroy dwr-zroy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with local run, and performance was good on my machine. Processes didn't linger after the run was over for too long.

Looks good to me.

@dwr-bli dwr-bli merged commit 16f5a43 into main May 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants