Skip to content
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

Logging configuration #24

Open
stevezau opened this issue Dec 23, 2016 · 2 comments
Open

Logging configuration #24

stevezau opened this issue Dec 23, 2016 · 2 comments

Comments

@stevezau
Copy link

Hi, When running invoke locally it appears it does not configure logging..

Should it ?

No handlers could be found for logger "root"
@jmeekhof
Copy link
Collaborator

jmeekhof commented Jun 3, 2017

Can you elaborate?

Are you import logging?

@mconigliaro
Copy link

mconigliaro commented Oct 26, 2018

It looks like something else already configured the root logger (both locally and on AWS), so I made my own, and that seemed to fix it:

logger = logging.getLogger('handler')
logger.handlers = []
logger.setLevel(getattr(logging, os.environ['LOG_LEVEL'], logging.NOTSET))
log_handler = logging.StreamHandler()
log_handler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s'))
logger.addHandler(log_handler)
logger.propagate = False

More info here: https://forum.serverless.com/t/python-lambda-logging-duplication-workaround/1585/6

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

No branches or pull requests

4 participants