Skip to content

fix: stop creating root.log on autoarray import#285

Merged
Jammy2211 merged 1 commit intomainfrom
feature/fix-autoarray-root-log
Apr 18, 2026
Merged

fix: stop creating root.log on autoarray import#285
Jammy2211 merged 1 commit intomainfrom
feature/fix-autoarray-root-log

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Removes the FileHandler (with filename: root.log) from the packaged autoarray/config/logging.yaml and its test-config mirror. The handler was attached to the root logger unconditionally, so importing autoarray from a cwd whose own config/logging.yaml did not override it (e.g. a bare repo root) caused a root.log file to be dropped into that cwd. Console StreamHandler logging is unchanged.

Reproduction (before the fix): cd <any dir without config/logging.yaml> && python -c "import autoarray" → an empty root.log appears. After the fix the root logger has only a StreamHandler and no file is written.

API Changes

None — internal configuration change only. No public Python symbols are affected.
See full details below.

Test Plan

  • pytest test_autoarray/ -x → 732 passed
  • Repro check in a neutral cwd: python -c "import autoarray; import logging; print([type(h).__name__ for h in logging.getLogger().handlers])" reports ['StreamHandler'] only, and no root.log is written.
  • Regression check from autofit_workspace/: behaviour unchanged (workspace logging.yaml already won before; still wins now).
Full API Changes (for automation & release notes)

Removed

  • (none — public API untouched)

Added

  • (none)

Changed Behaviour

  • Importing autoarray no longer attaches a logging.FileHandler writing to root.log in cwd. Users who relied on this implicit file log must now configure their own FileHandler in their workspace config/logging.yaml.

Migration

  • If a user wants file logging, add a file handler to their own config/logging.yaml and include it under root.handlers.

🤖 Generated with Claude Code

Remove the FileHandler with filename root.log from autoarray's packaged
logging.yaml (and the test config mirror). It attached to the root logger
unconditionally, dropping a root.log into cwd whenever a script imported
autoarray from a directory whose own config/logging.yaml did not override
this one (e.g. running from a repo root rather than a workspace dir).

Console logging via StreamHandler is unchanged.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Apr 18, 2026
@Jammy2211
Copy link
Copy Markdown
Collaborator Author

Smoke Test Results — 2026-04-18

Workspace Passed Failed Total
autofit_workspace 7 0 7
autogalaxy_workspace 4 2 6
autolens_workspace 6 1 7
autolens_workspace_test 11 1 12

28 / 32 passed. All 4 failures are missing committed FITS datasets (FileNotFoundError), unrelated to this PR — removing the root.log FileHandler does not touch FITS loading, dataset paths, or any code path that these scripts hit before they fail.

Failures (pre-existing, unrelated)
  • autogalaxy_workspace/interferometer/start_here.pyFileNotFoundError: dataset/interferometer/uv_wavelengths/sma.fits
  • autolens_workspace/interferometer/modeling.py → same sma.fits missing
  • autogalaxy_workspace/imaging/start_here.pyFileNotFoundError: dataset/imaging/extra_galaxies/mask_extra_galaxies.fits
  • autolens_workspace_test/database/scrape/general.pyFileNotFoundError: dataset/imaging/no_lens_light/data.fits

@Jammy2211 Jammy2211 merged commit 6bc1213 into main Apr 18, 2026
4 checks passed
@Jammy2211 Jammy2211 deleted the feature/fix-autoarray-root-log branch April 18, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant