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
已提问 2 年前507 查看次数
1 回答
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
专家
Greg_B
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则