'Greengrass v2 logging from within the component
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 .log or greengrass.log files. I've tried different logging levels too. and with logger.debug("...")
Solution 1:[1]
Are you running Python with the -u argument to disable output buffering? Without this argument, Python scripts might not output logs.
See this troubleshooting entry: Python script doesn't log messages
Solution 2:[2]
I ended up configuring my logging to:
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Finn Thompson |
| Solution 2 | Sash |
