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

Log warning and error messages are not printed to console #777

Closed
djhoese opened this issue May 17, 2019 · 0 comments · Fixed by #778
Closed

Log warning and error messages are not printed to console #777

djhoese opened this issue May 17, 2019 · 0 comments · Fixed by #778

Comments

@djhoese
Copy link
Member

djhoese commented May 17, 2019

Describe the bug
In python 3 doing logger.warning or logging.error should print to the console/terminal by default. However, in #146 we added a NullHandler to the logger if one was not already created and this is causing the warn/error messages to not be printed. We should update this to only add the NullHandler if the user is not in an interactive environment.

After testing a few things I've noticed that in:

  • Python 2

    Not having a handler configured and using the logger produces No handlers could be found for logger "satpy.my_test" and no log messages.

  • Python 3

    Not having a handler configured and using the logger causes warnings/errors to be printed out. Which IMO is desired.

To Reproduce

Use Satpy and cause any error/warning message to be logged.

Expected behavior
Print error/warning log messages if no handler is configured (default for python 3). No warning about a missing handler when no handler is configured.

Since we still support python 2, my proposed solution is to only add the NullHandler if we are on python 2 and we don't have any handlers configured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant