Skip to content

πŸ› [Bug] Log level changed in client codeΒ #3145

Closed
@seymurkafkas

Description

@seymurkafkas

This logging callsets up the root logger at import time. This is problematic, because:

  • Client projects want to configure logging on their own.
  • A second handler may be added to the root logger (e.g. when the client code doesn't use logging.basicConfig). This means duplicated logs, which leads to double the storage costs, should someone use torch_tensorrt in production.

How to Reproduce:

import logging
import torch_tensorrt  # This import triggers logging.basicConfig 


_LOGGER = logging.getLogger()
_LOGGER.addHandler(logging.StreamHandler())

print(f"Number of handlers on root logger: {len(_LOGGER.handlers)}")
# THIS MEANS DUPLICATE LOGS

Result: Number of handlers on root logger: 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions