Skip to content

Replace logging.basicConfig() with something more sensible #254

@gaurav

Description

@gaurav

logging.basicConfig(...) is executed at module import time, which can override/lock in logging configuration for any process that imports api.server (including tests and ASGI servers). Consider moving logging configuration to the executable entrypoint (e.g., main.py) or only configuring if no handlers are present, to avoid side effects for library consumers.

if not logging.getLogger().hasHandlers():
    logging.basicConfig(level=os.getenv("LOGLEVEL", logging.INFO))

Originally posted by @Copilot in #253

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions