developmentseed / eoapi-devseed

Custom eoAPI framework example for DevelopmentSeed
https://eoapi.dev/customization/
MIT License
5 stars 2 forks source link

Run Python in non-buffered mode #11

Closed alukach closed 1 month ago

alukach commented 1 month ago

What I'm changing

I've been noticing that there are times when my log statements or print statements are not visible in a python-based docker compose service's output until I close/restart the service. This is because Python buffers its stdout by default.

How I did it

Run services with PYTHONBUFFERED=1 env var, which is akin to python -u .... As described in the docs:

Force the stdout and stderr streams to be unbuffered. This option has no effect on the stdin stream.

With this enabled, logs and print statements are made immediately available in the docker compose output.