Skip to content

logging.basicConfig() called in three modules, only first one takes effect #278

Description

@avinxshKD

concore.py, mkconcore.py, and copy_with_port_portname.py all call logging.basicConfig() at module level.

Python docs are clear: only the first basicConfig() call actually configures the root logger, subsequent calls are silently ignored.

  • concore.py (line 9): format='%(levelname)s - %(message)s'
  • mkconcore.py (~line 100): uses TRIMMED_LOGS flag to choose format
  • copy_with_port_portname.py (line 8): format='%(message)s'

Depending on import order, only one of these wins and the other two are dead code. When mkconcore.py imports copy_with_port_portname (which it does), whichever loads first takes over logging for the entire process.

Not a crasher, but makes debugging harder since log output format depends on import order instead of being deterministic.

Fix: use logging.getLogger(__name__) in each module and configure basicConfig once in the entry point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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