Skip to content

boto level logging #21

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
marcioemiranda opened this issue Apr 15, 2020 · 3 comments
Closed

boto level logging #21

marcioemiranda opened this issue Apr 15, 2020 · 3 comments
Assignees

Comments

@marcioemiranda
Copy link

Hello Heitor,

I am using samplig rate for my logger. An annoying side effect is that when it's enabled, it gets flooded with boto debug logs.

I took a look in the code and found a boto_level parameter in the setup function under aws_lambda_logging.py. I assume if I set this parameter to a different level then it would solve this problem.

Can I set this up via the logger_setup function in logger.py?

@marcioemiranda
Copy link
Author

I've taken a look at the other issues..

Looks like this is a duplicate of #16

@heitorlessa
Copy link
Contributor

heitorlessa commented Apr 15, 2020 via email

@heitorlessa
Copy link
Contributor

heitorlessa commented Apr 24, 2020

This is now fixed in 0.8.0 - Here's what you need to do.

  • Use the new Logger as opposed to logger_setup and logger_inject_lambda_context
  • If you want to enable DEBUG for the whole package, use set_package_logger function
  • The new Logger isolates and doesn't propagate any logging configuration, and you have full control over the logger if you wish to make any modifications
  • UX stays the same both in params to Logger class, and environment variable LOG_LEVEL

Thanks again @marcioemiranda for the patience while I researched better ways to fix this.


from aws_lambda_powertools.logging import Logger
from aws_lambda_powertools.logging.logger import set_package_logger

set_package_logger() # Enable package diagnostics (DEBUG log), if you want
logger = Logger() 

@logger.inject_lambda_context
def lambda_handler(event, context):
    ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants