Open manas007 opened 2 months ago
Hi, @manas007!
I believe, that is neither gunicorn nor docker issue. That is a pure python.
References:
First of all, learn how logging module works - when you initialize a Logger instance, or initialize application you need to set a configuration.
To direct your logs to stdout try following:
` import logging
logger = logging.getLogger(name) logger.setLevel(logging.INFO) logger.info("your log info...") `
However, since you use Flask, you should configure logging through the flask application config: https://flask.palletsprojects.com/en/latest/logging/
I am trying to run a simple app and i can't seem to get any logs when my container is up. I am unable to determine the issue and I have read multiple open/close threads about it.
Here is my dockerfile:
here is my bare minimum app.py, and the src.utils.setting is where i am reading env variables from .env file and doing some logging, based on the APPLICATION_ENVIRONMENT .
in the container logs, i can only see [2024-09-09 21:49:28 +0000] [7] [INFO] Starting gunicorn 22.0.0 [2024-09-09 21:49:28 +0000] [7] [INFO] Listening at: http://0.0.0.0:5000 (7) [2024-09-09 21:49:28 +0000] [7] [INFO] Using worker: sync [2024-09-09 21:49:28 +0000] [8] [INFO] Booting worker with pid: 8
however the logs in the module
from src.utils.setting import APP_HOST, APP_PORT, APP_DEBUG, DEV_TOOLS_PROPS_CHECK
do not show up at all.i am very confused as to what to do to accomplish stdout logging