-
Notifications
You must be signed in to change notification settings - Fork 403
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(logger-utils): ensure external loggers doesn't propagate logs on config copy #1075
fix(logger-utils): ensure external loggers doesn't propagate logs on config copy #1075
Conversation
dfb79b6
to
51ee897
Compare
@heitorlessa please review |
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.
Additional test to ensure we don't break child loggers
e550eaa
to
692dcd6
Compare
692dcd6
to
3d3bfc8
Compare
….com/mploski/aws-lambda-powertools-python into fix/existing-loggers-duplicated-logs * 'fix/existing-loggers-duplicated-logs' of https://github.com/mploski/aws-lambda-powertools-python: Add child loggers validation test Ensure external loggers doesnt propagate logs
Codecov Report
@@ Coverage Diff @@
## develop #1075 +/- ##
========================================
Coverage 99.96% 99.96%
========================================
Files 119 119
Lines 5373 5376 +3
Branches 613 613
========================================
+ Hits 5371 5374 +3
Partials 2 2
Continue to review full report at Codecov.
|
@mploski made a performance change (package_logger as constant over logger instance), removed an unnecessary test, and repurposed that child logger test to cover the rule of not touching child loggers. I'll merge and make a release once you're okay with it |
In another PR, it's worth cleaning up the test functions/fixtures as I noticed they're duplicated from functional/test_logger - in this case, it's easier to have a logger utils for our tests and easily reuse via import (low priority) |
We need to also cover one blind spot to not break passing keys between child and parent. We may either prohibit from passing child logger as source to this method our automatically decapsulate parent logger and exclude it from modification to avoid setting propagate=False as it breaks things. Added fix for this specific part in latest commit. Please review it and if it works for you we can merge it |
…logger is passed as source_logger
Awesome, checking as soon as I finish one last meeting |
Co-authored-by: Heitor Lessa <[email protected]>
Issue #, if available:
#1073
Description of changes:
Ensure external loggers doesn't propagate logs to root logger by disabling Propagate attribute. Previously event was emitted in external logger ( with powertools handler) and in root handler IF propagation was set to True. This change ensure log is only emitted by external logger handler.
Also, during debugging noticed that we don't exclude
aws_lambda_powertools
from handler modification since this is root powertools package we might treat it as internal package and skip applying powertools logger handler. @heitorlessa please correct me if I'm wrong hereChecklist
Breaking change checklist
RFC issue #:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.