You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
ARG PYTHON_VERSION=3.11.3
# application in prod or dev
ARG APPLICATION_ENVIRONMENT='prod'
FROM python:${PYTHON_VERSION}-slim as base
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/src
WORKDIR /src
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
python -m pip install -r requirements.txt
USER appuser
COPY . .
EXPOSE 5000
CMD gunicorn 'src.app:server' --bind=0.0.0.0:5000 -e APP_ENV=${APPLICATION_ENVIRONMENT} --access-logfile -
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 .
import logging
from flask import Flask
import dash
from dash import html, dcc, callback, Output, Input, State, no_update
from dash.exceptions import PreventUpdate
import plotly.graph_objects as go
import plotly.express as px
from src.utils.setting import APP_HOST, APP_PORT, APP_DEBUG, DEV_TOOLS_PROPS_CHECK
import dash_bootstrap_components as dbc
from src.components import navbar
from src.service.ede_service import EdeService
server = Flask(__name__)
# bootstrap theme for the page
app = dash.Dash(__name__, server=server, external_stylesheets=[dbc.themes.FLATLY])
app.layout = html.Div(
[
dbc.Container([
dbc.Row([
dbc.Col(children='Start Date', width=1),
dbc.Col(dbc.Input(id="start_date", type="date"), width=3),
dbc.Col(children='End Date', width=1),
dbc.Col(dbc.Input(id="end_date", type="date"), width=3),
])
]),
]
)
if __name__ == "__main__":
logging.info("Starting the Dash Application")
try:
app.run(
host=APP_HOST,
port=APP_PORT,
debug=APP_DEBUG,
dev_tools_props_check=DEV_TOOLS_PROPS_CHECK
)
except Exception as e:
logging.error(f'failed to start the server : {e}', exc_info=True)
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: