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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠