From 34da61647b2d091757091530b207bb1fd659d563 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 26 Oct 2024 10:53:15 +0200 Subject: [PATCH] Non blocking error message when Glances starts from a container (alpine-dev image) #2991 --- .dockerignore | 1 + docker-files/alpine.Dockerfile | 10 +++++++--- docker-files/ubuntu.Dockerfile | 10 +++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 45e2da8a3a..f1bb98a92f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -15,6 +15,7 @@ # Include Config file !/docker-compose/glances.conf +!/docker-files/docker-logger.json # Include Binary file !/docker-bin.sh diff --git a/docker-files/alpine.Dockerfile b/docker-files/alpine.Dockerfile index 2b2bfe66f5..9d76d6eed1 100644 --- a/docker-files/alpine.Dockerfile +++ b/docker-files/alpine.Dockerfile @@ -138,6 +138,10 @@ COPY --from=buildFull /venv /venv # RELEASE: dev - to be compatible with CI FROM full as dev -# Forward access and error logs to Docker's log collector -RUN ln -sf /dev/stdout /tmp/glances-root.log \ - && ln -sf /dev/stderr /var/log/error.log \ No newline at end of file +# Add the specific logger configuration file for Docker dev +# All logs will be forwarded to stdout +COPY ./docker-files/docker-logger.json /app +ENV LOG_CFG=/app/docker-logger.json + +WORKDIR /app +CMD /venv/bin/python3 -m glances $GLANCES_OPT \ No newline at end of file diff --git a/docker-files/ubuntu.Dockerfile b/docker-files/ubuntu.Dockerfile index 3a5ccc4c63..93320faa81 100644 --- a/docker-files/ubuntu.Dockerfile +++ b/docker-files/ubuntu.Dockerfile @@ -128,6 +128,10 @@ COPY --from=buildFull /venv /venv FROM full as dev ARG PYTHON_VERSION -# Forward access and error logs to Docker's log collector -RUN ln -sf /dev/stdout /tmp/glances-root.log \ - && ln -sf /dev/stderr /var/log/error.log +# Add the specific logger configuration file for Docker dev +# All logs will be forwarded to stdout +COPY ./docker-files/docker-logger.json /app +ENV LOG_CFG=/app/docker-logger.json + +WORKDIR /app +CMD /venv/bin/python3 -m glances $GLANCES_OPT \ No newline at end of file