Skip to content

fix: do not configure root logger on import - #227

Open
kwy404 wants to merge 1 commit into
adobe:mainfrom
kwy404:fix/import-root-logging
Open

kwy404 wants to merge 1 commit into
adobe:mainfrom
kwy404:fix/import-root-logging

Conversation

@kwy404

@kwy404 kwy404 commented Sep 24, 2026

Copy link
Copy Markdown

Description

Since 0.16.x, himl/config_generator.py calls logging.basicConfig() and sets the root logger level at import time, so import himl attaches a handler to the root logger and applications that configure their own handlers get duplicated log messages. This removes the module level configuration from the library module and configures logging in the himl CLI entry point instead, so the CLI still prints its INFO messages. himl-config-merger keeps its existing configuration in config_merger.py.

Fixes #210

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvement

Testing

  • Tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested the changes manually

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Additional Notes

The new test in tests/test_main.py imports himl in a subprocess and checks that the root logger has no handlers; it fails before this change and passes after. On Windows, 6 tests in tests/test_config_merger.py fail both before and after this change (temp file locking and console encoding), all other tests pass.

@kwy404

kwy404 commented Oct 3, 2026

Copy link
Copy Markdown
Author

Hi @amuraru, friendly ping: this is approved and the checks pass. Is there anything else you need from me before it can be merged?

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.

[BUG] Importing himl adds root logging formatter which affects application logging.

2 participants