-
Notifications
You must be signed in to change notification settings - Fork 429
Bug: sys.stderr is used as default logging stream #2735
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
Comments
Thank you @bram-tv for reporting it - looking into it. Out of curiosity, how does that affect you when running on AWS Lambda runtime? Or are you running outside of Lambda? Thank you |
Confirmed, working on a fix soon |
Fix is up - kept took slightly longer than expected due to a bug in pytest when asserting stderr |
It affected me during development of a Lambda function, which I suppose is technically outside of Lambda. Concrete: when running the code using serverless in combination with :
|
Gotcha, that makes sense. It'll be available in the next release (either this Friday or the next Friday). Thanks for clarifying and for reporting it one more time :) |
This is now released under 2.20.0 version! |
This seems like a breaking change for folks that currently use the library and expect certain logs to go to |
Uh oh!
There was an error while loading. Please reload this page.
Expected Behaviour
The API documentation of
Logger()
contains:This is no longer the case.
Current Behaviour
The
sys.stderr
stream is used as default logging stream.Code snippet
Possible Solution
No response
Steps to Reproduce
Run the above code but redirect stdout to /dev/null:
Message still shows up, i.e. it's not being logged to stdout.
Run the above code but redirect stderr to /dev/null
Another way to see it is by using strace:
It's writing to stderr..
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.10
Packaging format used
PyPi
Debugging logs
This issue was introduced in commit 0dc5e1b.
More specific:
old code:
new code:
Extra context: by default
stream
isNone
and usinglogging.StreamHandler(None)
by default uses stderr.https://docs.python.org/3.10/library/logging.handlers.html
The text was updated successfully, but these errors were encountered: