Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

native logger integration / dep loglevel config? #649

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
KiaraGrouwstra opened this issue Aug 24, 2021 · 6 comments
Closed

native logger integration / dep loglevel config? #649

KiaraGrouwstra opened this issue Aug 24, 2021 · 6 comments
Labels
need-more-information Pending information to continue

Comments

@KiaraGrouwstra
Copy link

Python comes with some logging niceties built-in, among which the ability to use yaml-based configuration for logging. this facilitates e.g. the configuration of logging levels of dependencies.
this sounds nice, but i'm not sure how to achieve something similar with powertools's logger. is this something that is currently possible, or might this be desirable as a potential enhancement?

@KiaraGrouwstra KiaraGrouwstra added feature-request feature request triage Pending triage from maintainers labels Aug 24, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 24, 2021

Thanks for opening your first issue here! We'll come back to you as soon as we can.

@heitorlessa
Copy link
Contributor

hey @KiaraGrouwstra thank you for creating it - apologies for the delay, just got back from a long vacation.

For setting the log level, you can use either Logger(level="DEBUG") or simply the environment variable LOG_LEVEL as per our docs: https://awslabs.github.io/aws-lambda-powertools-python/latest/core/logger/#getting-started

Child loggers (Logger(child=true)) have bi-directional sync, which means if you change the logger it'll replicate both ways, for example if you add a new key: logger.append_keys(payment_id="123")

We don't plan to add a YAML based config as you don't need to configure it like you do the traditional logger, you simply do logger = Logger(), and it just works. You can opt-in for other features like setting correlation ID, log sampling, but you'd want to do this conditionally, not statically.

Does that help?

I'm more than happy to clarify any questions you might have.

@heitorlessa heitorlessa added need-more-information Pending information to continue and removed triage Pending triage from maintainers feature-request feature request labels Sep 27, 2021
@KiaraGrouwstra
Copy link
Author

hi,
this issue i'm concerned about is about dependencies.
i know that for my own code i can control which logging level of messages will be printed.
the issue is, i'm consuming other pip packages that log things as well, and in some cases turn out buggy.
in such cases, i would like to be able to print debug-level info for such a broken package.
that is something that by default python logging can achieve. however, as i currently understand it, since the powertools logging library does not hook into this built-in way of logging, it lacks that functionality.
is this understanding correct?

@heitorlessa
Copy link
Contributor

heitorlessa commented Sep 27, 2021 via email

@heitorlessa
Copy link
Contributor

Checking in to see if this helped, and whether we could have more details on the issue report about the workflow to address this properly

@KiaraGrouwstra
Copy link
Author

hi there,
i'm not sure i fully understood the proposed solution.
i wanna use this library for logging, while a buggy dependency of mine is not aware of the existence of this library. moreover, given this is an external library i'm consuming, i do not have direct control over the code it uses.
if i use native logging for my own application, i can configure the logging level for my buggy dependency using config files.
what would be the equivalent when for my own application i wish to log using aws-lambda-powertools?

@aws-powertools aws-powertools locked and limited conversation to collaborators Nov 13, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
need-more-information Pending information to continue
Projects
None yet
Development

No branches or pull requests

2 participants