You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: programmatically changing the log level fails #2303
When changing the log level of a Logger via code, the log level should be changed.
from aws_lambda_powertools import Logger
powertools_logger = Logger()
powertools_logger.setLevel("DEBUG") # the log level should become DEBUG
powertools_logger.debug("Hello, world!") # this should produce a log message
Current Behaviour
When changing the log level of a Logger via code, the log level is not changed.
from aws_lambda_powertools import Logger
powertools_logger = Logger()
powertools_logger.setLevel("DEBUG") # the log level remains at the default, INFO
powertools_logger.debug("Hello, world!") # no log message comes out
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: Invite link
Hey Paul, thank you so much for reporting this — could you tell me if
setting the log_level attribute to debug works?
powertools_logger.log_level = logging.DEBUG
If it does work, I suspect setLevel is changing the superclass and not
._logger as it should be.
Thanks a lot taking the time to report it, we should fix it — we welcome a
PR if you know your way around Python logging (logger.py file)
Hi @heitorlessa and @paulsuh! I could reproduce the error and it's changing the superclass logging.Logger instead of changing the Powertools instance: ._logger in this case.
Paul, do you want to send a PR to fix this and get your first contribution to Powertools? If not, I can send the PR to fix this and give you the credits.
Hello @paulsuh! Can I help you write this fix? We are planning to release a new version today or tomorrow and it would be nice if we could include this fix.
No pressure here, we know everyone is busy with different things at work, I'm really here to offer help or even just write this and discuss the solution together when sending the PR.
Activity
boring-cyborg commentedon May 22, 2023
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: Invite link
heitorlessa commentedon May 22, 2023
leandrodamascena commentedon May 22, 2023
Hi @heitorlessa and @paulsuh! I could reproduce the error and it's changing the superclass
logging.Loggerinstead of changing the Powertools instance: ._loggerin this case.Paul, do you want to send a PR to fix this and get your first contribution to Powertools? If not, I can send the PR to fix this and give you the credits.
Thank you
paulsuh commentedon May 22, 2023
Let me clone the repo and see what I can do
leandrodamascena commentedon May 23, 2023
Hello @paulsuh! Can I help you write this fix? We are planning to release a new version today or tomorrow and it would be nice if we could include this fix.
No pressure here, we know everyone is busy with different things at work, I'm really here to offer help or even just write this and discuss the solution together when sending the PR.
Thank you so much!
github-actions commentedon May 24, 2023
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Jun 2, 2023
This is now released under 2.16.1 version!