Skip to content

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

@jasonkarcz

Description

@jasonkarcz

Bug Description

A change somewhere between v0.16.0 and v0.18.0 has caused applications that import himl and use a custom log formatter to receive duplicated log messages.

To Reproduce

$ cat himl_logging_bug.py
import argparse
import logging

parser = argparse.ArgumentParser()
parser.add_argument("--himl", action="store_true", help="Import himl")
args = parser.parse_args()
if args.himl:
    import himl

logger = logging.getLogger("my_logger")
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s")
console_handler = logging.StreamHandler()
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)

logger.info("Test log message")

$ pip install himl==0.16.0 &>/dev/null

$ python himl_logging_bug.py
2025-12-03 12:02:40,599 - INFO - my_logger - Test log message

$ python himl_logging_bug.py --himl
2025-12-03 12:02:43,993 - INFO - my_logger - Test log message

$ pip install himl==0.18.0 &>/dev/null

$ python himl_logging_bug.py
2025-12-03 12:02:54,574 - INFO - my_logger - Test log message

$ python himl_logging_bug.py --himl
2025-12-03 12:02:56,520 - INFO - my_logger - Test log message
INFO:my_logger:Test log message

Expected Behavior

Importing himl does not affect application logging.

Actual Behavior

Importing himl causes duplicated log messages.

Environment

  • OS: Fedora 42
  • Python version: 3.13.7
  • himl version: 0.18.0
  • Installation method: pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions