Skip to content

Bug: programmatically changing the log level fails #2303

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

Closed
paulsuh opened this issue May 22, 2023 · 7 comments · Fixed by #2320
Closed

Bug: programmatically changing the log level fails #2303

paulsuh opened this issue May 22, 2023 · 7 comments · Fixed by #2320
Assignees
Labels
bug Something isn't working logger

Comments

@paulsuh
Copy link

paulsuh commented May 22, 2023

Expected Behaviour

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

Code snippet

See above, also the linked repo below

Possible Solution

No response

Steps to Reproduce

See https://github.com/paulsuh/aws-powertools-logging-test-sam for detailed test cases and output.

AWS Lambda Powertools for Python version

latest

AWS Lambda function runtime

3.9

Packaging format used

Serverless Application Repository (SAR) App

Debugging logs

No response

@paulsuh paulsuh added bug Something isn't working triage Pending triage from maintainers labels May 22, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented 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
Copy link
Contributor

heitorlessa commented May 22, 2023 via email

@leandrodamascena
Copy link
Contributor

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.

Thank you

@leandrodamascena leandrodamascena self-assigned this May 22, 2023
@leandrodamascena leandrodamascena added logger and removed triage Pending triage from maintainers labels May 22, 2023
@paulsuh
Copy link
Author

paulsuh commented May 22, 2023

Let me clone the repo and see what I can do

@leandrodamascena
Copy link
Contributor

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
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

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 github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label May 24, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2023

This is now released under 2.16.1 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working logger
Projects
None yet
3 participants