We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pip install sagemaker
Simply importing the sagemaker module alterates the logging module configuration.
Consider the following code:
import logging logging.basicConfig(level='DEBUG', format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M') logging.debug("debug") logging.info('info') logging.error('error') logging.warning("WARNING")
When ran, will output:
04-18 09:15 root DEBUG debug 04-18 09:15 root INFO info 04-18 09:15 root ERROR error 04-18 09:15 root WARNING WARNING
as expected. Now, the modified code, the only difference being the import of the sagemaker module:
import logging import sagemaker logging.basicConfig(level='DEBUG', format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M') logging.debug("debug") logging.info('info') logging.error('error') logging.warning("WARNING")
will output:
WARNING:root:pandas failed to import. Analytics features will be impaired or broken. ERROR:root:error WARNING:root:WARNING
The logging level and formatting has been overwritten (the warning about pandas is not the problem I'm pointing at).
The text was updated successfully, but these errors were encountered:
I think the problem arise because:
import sagemaker
logging.basicConfig
logging.basicConfig() LOGGER = logging.getLogger('sagemaker') LOGGER.setLevel(logging.INFO)
which does call logging.basicConfig(). According to the python documentation about logging:
logging.basicConfig()
This function does nothing if the root logger already has handlers configured for it.
I don't think a module should configure any logging parameters (i.e.: only the line LOGGER = logging.getLogger('sagemaker') should remain).
LOGGER = logging.getLogger('sagemaker')
Workaround: do not import sagemaker before calling logging.basicConfig() at a higher level.
Sorry, something went wrong.
hi @eprochasson, thanks for the detailed bug report! I've created a PR to address this bug: #757
the changes have now been released. closing this issue.
No branches or pull requests
System Information
pip install sagemaker
)Describe the problem
Simply importing the sagemaker module alterates the logging module configuration.
Minimal repro / logs
Consider the following code:
When ran, will output:
as expected. Now, the modified code, the only difference being the import of the sagemaker module:
will output:
The logging level and formatting has been overwritten (the warning about pandas is not the problem I'm pointing at).
The text was updated successfully, but these errors were encountered: