Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug] Log level changed in client code #3145

Closed
seymurkafkas opened this issue Sep 4, 2024 · 4 comments
Closed

🐛 [Bug] Log level changed in client code #3145

seymurkafkas opened this issue Sep 4, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@seymurkafkas
Copy link
Contributor

seymurkafkas commented Sep 4, 2024

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

@seymurkafkas seymurkafkas added the bug Something isn't working label Sep 4, 2024
@seymurkafkas seymurkafkas changed the title 🐛 [Bug] Log level changed in client code (High Priority) 🐛 [Bug] Log level changed in client code Sep 4, 2024
@narendasan
Copy link
Collaborator

Seems reasonable to me to remove this, would you be able to submit a patch?

@seymurkafkas
Copy link
Contributor Author

seymurkafkas commented Sep 4, 2024

Seems reasonable to me to remove this, would you be able to submit a patch?

For sure, will submit a fix in a moment 👍

@seymurkafkas
Copy link
Contributor Author

seymurkafkas commented Sep 5, 2024

Submitted a fix in this PR #3147 @narendasan

@narendasan
Copy link
Collaborator

Fixed in #3147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants