So, I've got some Python code running inside a Docker container. I started up my local env using Google's gcloud script. I'm seeing basic access style logs and health check info, but I'm not sure how I can pass through log messages I'm writing from my Python app to the console. Is there a parameter I can set to accomplish this with my gcloud script or is there something I can set in the Dockerfile that can help?
For Python to log on your terminal/command line/console, when executed from a docker container, you should have this variable set in your docker-compose.yml
environment:
- PYTHONUNBUFFERED=0
This is also a valid solution if you're using print
to debug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With