Skip to content

fix(fmuobs): avoid duplicate log output from submodule loggers - #893

Merged
rnyb merged 2 commits into
mainfrom
fmuobs-fix
Nov 9, 2026
Merged

rnyb merged 2 commits into
mainfrom
fmuobs-fix

Conversation

@rnyb

@rnyb rnyb commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator
  • Set the level on the "subscript.fmuobs" logger separately
  • Clear handlers on submodule loggers so records propagate only to the parent handlers and are not printed twice

Closes #894

- Set the level on the "subscript.fmuobs" logger separately
- Clear handlers on submodule loggers so records propagate only to
  the parent handlers and are not printed twice
@rnyb
rnyb requested a balanced review from Copilot November 9, 2026 11:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

A regression test must capture stream output and assert that a submodule message is printed exactly once, because the existing tests still pass when duplicate output occurs.

1 open issue
What changed in this PR

This PR fixes duplicate log output in FMUOBS by relying on parent handlers to emit records from submodule loggers.

Changes:

  • Sets the subscript.fmuobs logger level separately.
  • Preserves submodule log levels while clearing their handlers to avoid duplicate output.
File Description
src/​subscript/​fmuobs/​fmuobs.py Updates logging configuration so submodule records propagate without duplicate local handling.

Review effort: Balanced

Comment thread src/subscript/fmuobs/fmuobs.py Resolved
@codecov-commenter

codecov-commenter commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.47%. Comparing base (233cbd1) to head (b10bb34).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #893   +/-   ##
=======================================
  Coverage   84.47%   84.47%           
=======================================
  Files          49       49           
  Lines        7567     7570    +3     
=======================================
+ Hits         6392     6395    +3     
  Misses       1175     1175           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Add test running fmuobs in a subprocess and counting stdout lines
- Guard against duplicate output from multiple logging handlers
- Needed because caplog captures only at the root logger
@rnyb
rnyb requested a balanced review from Copilot November 9, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the change to prevent duplicate fmuobs log output.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@rnyb
rnyb requested a review from alifbe November 9, 2026 11:53

@alifbe alifbe 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.

LGTM 👍

@rnyb
rnyb merged commit 46a9e23 into main Nov 9, 2026
11 checks passed
@rnyb
rnyb deleted the fmuobs-fix branch November 9, 2026 19:31
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.

fmuobs - avoid duplicate log output

4 participants