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

logging error with 1.2.0 version #6172

Closed
cosmoquester opened this issue Feb 24, 2021 · 2 comments · Fixed by #6275
Closed

logging error with 1.2.0 version #6172

cosmoquester opened this issue Feb 24, 2021 · 2 comments · Fixed by #6275
Assignees
Labels
docs Documentation related help wanted Open to be worked on logging Related to the `LoggerConnector` and `log()` working as intended Working as intended

Comments

@cosmoquester
Copy link

🐛 Bug

if I use logger named "lightning", logger print log twice.
It happens with pytorch-lightning 1.2.0 version and doesn't happend with 1.1.8 version.
This is reproduced easily like below.

Error Example

Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch_lightning as pl
>>> import logging
>>> logger = logging.getLogger("lightning")
>>> logger.info("test")
test
>>> logging.basicConfig(level=logging.INFO)
>>> logger.info("test")
test
INFO:lightning:test
>>> pl.__version__
'1.2.0'
>>> import pytorch_lightning as pl
>>> import logging
>>> logger = logging.getLogger("lightning")
>>> logger.info("test")
>>> logging.basicConfig(level=logging.INFO)
>>> logger.info("test")
INFO:lightning:test
>>> pl.__version__
'1.1.8'

Please reproduce using the BoringModel

Don't need model.

To Reproduce

Refer above codes 1.2.0 version

Expected behavior

Refer above codes 1.1.8 version

Environment

  • PyTorch Version (e.g., 1.0): 1.2.0
  • OS (e.g., Linux): Ubuntu 20.04.1 LTS
  • How you installed PyTorch (conda, pip, source): pip
  • Build command you used (if compiling from source):
  • Python version: 3.7,9
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • Any other relevant information:

Additional context

@cosmoquester cosmoquester added bug Something isn't working help wanted Open to be worked on labels Feb 24, 2021
@Borda Borda added the logging Related to the `LoggerConnector` and `log()` label Feb 24, 2021
@awaelchli awaelchli self-assigned this Feb 24, 2021
@edenlightning edenlightning added the priority: 0 High priority task label Feb 25, 2021
@awaelchli
Copy link
Contributor

Hi, you need to use

logger = logging.getLogger("pytorch_lightning")

instead of

logger = logging.getLogger("lightning")

then you will get the correct logger.

Apologies, the docs here seem to be outdated
https://pytorch-lightning.readthedocs.io/en/latest/extensions/logging.html#configure-console-logging
I will update that

@edenlightning edenlightning added docs Documentation related working as intended Working as intended and removed bug Something isn't working priority: 0 High priority task labels Mar 1, 2021
@awaelchli
Copy link
Contributor

@psj8252 We merged a fix that was in 1.1.6 - 1.1.8 but it got lost and didn't make it into 1.2.
After Wednesday when the new version is out you can upgrade Lightning and duplicate logging will not occur anymore.
See the updated documentation section:
https://pytorch-lightning.readthedocs.io/en/latest/extensions/logging.html#configure-console-logging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related help wanted Open to be worked on logging Related to the `LoggerConnector` and `log()` working as intended Working as intended
Projects
None yet
4 participants