-
Notifications
You must be signed in to change notification settings - Fork 18
Fix logging behavior #287
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
Fix logging behavior #287
Conversation
| handler = get_rich_handler() | ||
| logging.basicConfig(level=getattr(logging, log_level), handlers=[handler]) | ||
| logger = logging.getLogger(name) | ||
| logger.addHandler(handler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to clear all handlers before adding this one back? If this gets called twice could end up with duplicate logs being printed
for handler in logger.handlers:
logger.removeHandler(handler)
logger.addHandler(handler)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed style issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think may need to run black .
|
black issue is unrelated to this PR |
Issue #, if available: fixes #286, also see aws/sagemaker-python-sdk#4945
Description of changes: This PR modifies logging utils such that the root logger behavior through
basicConfigis not changed, rather the log level and handler are changed for thesagemaker_core.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.