Greengrass v2 logging

0

I am unable to see anything that I may log out of a Greengrass v2 component.

For example:

import logging
...
...
logger = logging.getLogger()
logger.setLevel(logging.INFO)

...
...
logger.info("Hello world")

This will not be visible in my <COMPONENT>.log or greengrass.log files. I've tried different logging levels too.

Sash
demandé il y a 2 ans495 vues
1 réponse
0

You need to set a handler or set basic config. If you direct the logs to stdout, they will appear in the component log.

logger.addHandler(logging.StreamHandler(sys.stdout))
# or
logging.basicConfig(stream=sys.stdout, level=logging.INFO)

Or you could send them to a different file by using a FileHandler instead of a StreamHandler.

profile pictureAWS
EXPERT
Greg_B
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions