-
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
Bug: Logger Timestamps Misaligned with Local Time #3154
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hey @hemanth-m19! Thanks for bringing up this unexpected behavior when using our Logger utility. I was able to reproduce this error and indeed this should consider the localtime, but I have some considerations before we move forward: 1 - The default timezone in Lambda is UTC, it's means that doesn't matter the region the timezone always will be UTC. You can override the default timezone by setting the 2 - Even if you define the env variable 3 - I know the problem is here: https://github.com/aws-powertools/powertools-lambda-python/blob/develop/aws_lambda_powertools/logging/formatter.py#L171. But I need time to investigate further and find the best solution. 4 - We need to update our documentation to inform about Lambda So once again, thanks for opening this bug and we will try to fix it as soon as possible. If you want to submit a PR to fix it, or even have a suggestion, we're open to discussing about this. 🚀 |
@leandrodamascena , Thanks for the detailed info, You're absolutely correct, I tried the other day by configuring I just tried your suggestion a moment ago! I used the Logger utility with the use_rfc3339 parameter and configured the TZ environment variable, and it worked perfectly.
Sounds like a viable alternative to address the timestamp issue for now. Thanks again. |
Hi @roger-zhangg! Can you take a look at this? 👁️ |
Hi,
The previous root cause was completely wrong. The actual error is lambda runtime's |
|
This is now released under 2.26.0 version! |
Expected Behaviour
The logger should emit records using local time timestamp by default as per docs.
Current Behaviour
logger emits records using
utc
timestamp when running in Australia/Sydney timezoneCode snippet
Possible Solution
No response
Steps to Reproduce
Run above lambda code snippet in Sydney region (ap-southeast-2).
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.9
Packaging format used
Lambda Layers
Debugging logs
No response
The text was updated successfully, but these errors were encountered: