Skip to content

native logger integration / dep loglevel config? #649

Closed

Description

@KiaraGrouwstra

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?

Activity

  1. boring-cyborg commented on Aug 24, 2021

    @boring-cyborg

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

  2. heitorlessa commented on Sep 27, 2021

    @heitorlessa
    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.

  3. added and removed
    triagePending triage from maintainers
    on Sep 27, 2021
  4. KiaraGrouwstra commented on Sep 27, 2021

    @KiaraGrouwstra
    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?

  5. heitorlessa commented on Sep 27, 2021

    @heitorlessa
    Contributor
  6. heitorlessa commented on Oct 5, 2021

    @heitorlessa
    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

  7. KiaraGrouwstra commented on Oct 20, 2021

    @KiaraGrouwstra
    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?

  8. locked and limited conversation to collaborators on Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions