Skip to content

Quiet the notebook output: no debug flood from ImageJ TIFFs - #271

Merged
guijacquemet merged 3 commits into
mainfrom
claude/quiet-debug-log
Nov 10, 2026
Merged

guijacquemet merged 3 commits into
mainfrom
claude/quiet-debug-log

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

Owner report from Colab (v0.5.0, real ImageJ MAX-projection TIFFs): per image, DEBUG:...projection_marker:Cannot read the description of <path> plus a full ParseError traceback.

Causes

  1. projection_marker.is_projected_copy passed any first-page description to ElementTree.fromstring. ImageJ TIFFs have a plain-text description, so this failed for every such image (expected, not an error).
  2. notebook_ui._Attached set the package logger to DEBUG while its capture handler was attached, and records still propagated to the root logger. Colab's root has a NOTSET stream handler, so every package DEBUG record printed.

Fix

  • Only a description that starts with < is parsed; non-OME returns False silently. Malformed OME still returns False with one debug line, no traceback. Which images are marked is unchanged (projection_record_missing tests still pass).
  • While attached, propagate = False (restored on exit), and a small handler forwards WARNING+ to the root handlers, so warnings stay visible as before. DEBUG goes to the "Technical details" panel only.
  • CLI --log (cli.py _attach_log): checked, no change. It adds a file handler to the package logger, so the logging last-resort stderr handler is not used and nothing reaches stderr.

Other exc_info=True debug logs (not changed)

mounts.py:67, discovery.py:386, links.py:235,261, planes.py:659, metadata.py:295,330,338, ome_header.py:26, run/preflight.py:162, conversion_write.py:88,117. These log only on a real failure or per folder, not for every normal file; with the propagation fix none reaches the notebook output at DEBUG. ome_header.py:26 is already guarded by tif.is_ome.

Tests (fail before, pass after)

  • tests/test_projection_marker.py: ImageJ TIFF is not marked and logs no record; malformed OME is not marked with one debug record without exc_info; a marked projection is still marked.
  • tests/test_notebook_log_capture.py: with a NOTSET root StreamHandler, the attached capture keeps DEBUG off root but in the panel, WARNING reaches root, and logger state is restored.

Verification

python tools/check.py: 5167 passed, 4 skipped (case-sensitive file system x3, file-mode permissions x1; all unrelated), ruff clean, code rules ok.


Generated by Claude Code

is_projected_copy parsed every TIFF description as OME-XML, so each ImageJ
image logged a debug ParseError traceback. Only an OME-XML description is
parsed now; a malformed one logs one debug line without a traceback.

The notebook's log capture set the package logger to DEBUG while records
still propagated to the root logger (Colab prints them). While attached,
propagation is off and WARNING and above are forwarded to the root handlers.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
… root has no handler

Without a root handler (plain Jupyter), propagation would have reached
logging.lastResort; the forwarder now does the same, so package warnings stay
visible. Regression test fails without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
@guijacquemet
guijacquemet merged commit cee33dc into main Nov 10, 2026
7 checks passed
@guijacquemet
guijacquemet deleted the claude/quiet-debug-log branch November 10, 2026 18:18
guijacquemet pushed a commit that referenced this pull request Nov 10, 2026
…compact

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
guijacquemet pushed a commit that referenced this pull request Nov 10, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc

# Conflicts:
#	CHANGELOG.md
guijacquemet pushed a commit that referenced this pull request Nov 10, 2026
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