Closed
Description
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 usetorch_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