From d6036cb5ef82b7916e2dbdf8b3cabf7c36aba30d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 02:13:20 +0000 Subject: [PATCH 2/7] fix: respect LOGLEVEL env var for all log output sources Agent-Logs-Url: https://github.com/rommapp/romm/sessions/0b5ef21c-89e1-4f08-b402-03f3276aab08 Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com> --- backend/logger/formatter.py | 8 ++-- docker/init_scripts/docker-entrypoint.sh | 10 +++++ docker/init_scripts/init | 42 ++++++++++++++++++++ docker/nginx/templates/default.conf.template | 2 + 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/backend/logger/formatter.py b/backend/logger/formatter.py index b6b93afbf..2172c4b6d 100644 --- a/backend/logger/formatter.py +++ b/backend/logger/formatter.py @@ -3,7 +3,7 @@ from pprint import pformat from colorama import Fore, Style, init -from config import FORCE_COLOR, NO_COLOR +from config import FORCE_COLOR, LOGLEVEL, NO_COLOR RED = Fore.RED LIGHTRED = Fore.LIGHTRED_EX @@ -33,16 +33,16 @@ LOGGING_CONFIG = { }, "root": { "handlers": ["default"], - "level": "INFO", + "level": LOGLEVEL, }, "loggers": { "uvicorn": { - "level": "INFO", + "level": LOGLEVEL, "handlers": ["default"], "propagate": False, }, "uvicorn.error": { - "level": "INFO", + "level": LOGLEVEL, "handlers": ["default"], "propagate": False, }, diff --git a/docker/init_scripts/docker-entrypoint.sh b/docker/init_scripts/docker-entrypoint.sh index 71d3e8373..af504d9ac 100755 --- a/docker/init_scripts/docker-entrypoint.sh +++ b/docker/init_scripts/docker-entrypoint.sh @@ -39,6 +39,16 @@ done export ROMM_BASE_PATH=${ROMM_BASE_PATH:-/romm} export ROMM_PORT=${ROMM_PORT:-8080} +# Disable nginx access logs when log level is WARNING, ERROR, or CRITICAL +case "${LOGLEVEL:-INFO}" in + WARNING|ERROR|CRITICAL|warning|error|critical) + export NGINX_ACCESS_LOG="access_log off;" + ;; + *) + export NGINX_ACCESS_LOG="" + ;; +esac + # Set IPV6_LISTEN based on IPV4_ONLY if [[ ${IPV4_ONLY} == "true" ]]; then export IPV6_LISTEN="#listen [::]:${ROMM_PORT};" diff --git a/docker/init_scripts/init b/docker/init_scripts/init index f9d493160..f6ea88f6f 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -93,6 +93,48 @@ start_bin_gunicorn() { # cleanup potentially leftover socket rm /tmp/gunicorn.sock -f + # Generate gunicorn logging config with the configured log level + cat >/etc/gunicorn/logging.conf < Date: Sat, 11 Apr 2026 02:15:01 +0000 Subject: [PATCH 3/7] fix: use dynamic log level in gunicorn format and add auto-generated comment Agent-Logs-Url: https://github.com/rommapp/romm/sessions/0b5ef21c-89e1-4f08-b402-03f3276aab08 Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com> --- docker/gunicorn/logging.conf | 2 +- docker/init_scripts/init | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/gunicorn/logging.conf b/docker/gunicorn/logging.conf index e16918592..936958657 100644 --- a/docker/gunicorn/logging.conf +++ b/docker/gunicorn/logging.conf @@ -34,5 +34,5 @@ args=(sys.stdout,) # Formatter for Gunicorn logs [formatter_gunicorn_format] -format=INFO: [RomM][gunicorn][%(asctime)s] %(message)s +format=%(levelname)s: [RomM][gunicorn][%(asctime)s] %(message)s datefmt=%Y-%m-%d %H:%M:%S diff --git a/docker/init_scripts/init b/docker/init_scripts/init index f6ea88f6f..2d8300d7a 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -93,7 +93,8 @@ start_bin_gunicorn() { # cleanup potentially leftover socket rm /tmp/gunicorn.sock -f - # Generate gunicorn logging config with the configured log level + # Generate gunicorn logging config with the configured log level. + # Note: this file is auto-generated at startup; do not modify /etc/gunicorn/logging.conf directly. cat >/etc/gunicorn/logging.conf < Date: Fri, 10 Apr 2026 22:45:14 -0400 Subject: [PATCH 4/7] run fmt --- docker/init_scripts/docker-entrypoint.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/init_scripts/docker-entrypoint.sh b/docker/init_scripts/docker-entrypoint.sh index af504d9ac..5e8f66241 100755 --- a/docker/init_scripts/docker-entrypoint.sh +++ b/docker/init_scripts/docker-entrypoint.sh @@ -41,12 +41,12 @@ export ROMM_PORT=${ROMM_PORT:-8080} # Disable nginx access logs when log level is WARNING, ERROR, or CRITICAL case "${LOGLEVEL:-INFO}" in - WARNING|ERROR|CRITICAL|warning|error|critical) - export NGINX_ACCESS_LOG="access_log off;" - ;; - *) - export NGINX_ACCESS_LOG="" - ;; +WARNING | ERROR | CRITICAL | warning | error | critical) + export NGINX_ACCESS_LOG="access_log off;" + ;; +*) + export NGINX_ACCESS_LOG="" + ;; esac # Set IPV6_LISTEN based on IPV4_ONLY From bc9961cfe5317943a3fbc09525435a69a3aa7bec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 02:48:15 +0000 Subject: [PATCH 5/7] fix: remove dynamic gunicorn logging config generator from init script Agent-Logs-Url: https://github.com/rommapp/romm/sessions/bdfc3221-ba18-445d-9cf7-f4b495e82577 Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com> --- docker/init_scripts/init | 43 ---------------------------------------- 1 file changed, 43 deletions(-) diff --git a/docker/init_scripts/init b/docker/init_scripts/init index 2d8300d7a..f9d493160 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -93,49 +93,6 @@ start_bin_gunicorn() { # cleanup potentially leftover socket rm /tmp/gunicorn.sock -f - # Generate gunicorn logging config with the configured log level. - # Note: this file is auto-generated at startup; do not modify /etc/gunicorn/logging.conf directly. - cat >/etc/gunicorn/logging.conf < Date: Sat, 11 Apr 2026 09:58:32 -0400 Subject: [PATCH 6/7] changes from bot review --- backend/logger/formatter.py | 5 +++++ docker/gunicorn/logging.conf | 2 +- docker/init_scripts/docker-entrypoint.sh | 6 ++++-- docker/init_scripts/init | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/logger/formatter.py b/backend/logger/formatter.py index 2172c4b6d..33e303430 100644 --- a/backend/logger/formatter.py +++ b/backend/logger/formatter.py @@ -46,6 +46,11 @@ LOGGING_CONFIG = { "handlers": ["default"], "propagate": False, }, + "uvicorn.access": { + "level": LOGLEVEL, + "handlers": ["default"], + "propagate": False, + }, }, } diff --git a/docker/gunicorn/logging.conf b/docker/gunicorn/logging.conf index 936958657..54b564c43 100644 --- a/docker/gunicorn/logging.conf +++ b/docker/gunicorn/logging.conf @@ -12,7 +12,7 @@ keys=gunicorn_format level=WARNING handlers= -# Gunicorn internal logger +# Gunicorn internal logger (overridden at runtime) [logger_gunicorn] level=INFO handlers=console_gunicorn diff --git a/docker/init_scripts/docker-entrypoint.sh b/docker/init_scripts/docker-entrypoint.sh index 5e8f66241..5392c7b38 100755 --- a/docker/init_scripts/docker-entrypoint.sh +++ b/docker/init_scripts/docker-entrypoint.sh @@ -40,8 +40,10 @@ export ROMM_BASE_PATH=${ROMM_BASE_PATH:-/romm} export ROMM_PORT=${ROMM_PORT:-8080} # Disable nginx access logs when log level is WARNING, ERROR, or CRITICAL -case "${LOGLEVEL:-INFO}" in -WARNING | ERROR | CRITICAL | warning | error | critical) +loglevel="${LOGLEVEL:-INFO}" +loglevel="${loglevel^^}" +case "${loglevel}" in +WARNING | WARN | ERROR | CRITICAL) export NGINX_ACCESS_LOG="access_log off;" ;; *) diff --git a/docker/init_scripts/init b/docker/init_scripts/init index f9d493160..0a8ebb978 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -93,6 +93,10 @@ start_bin_gunicorn() { # cleanup potentially leftover socket rm /tmp/gunicorn.sock -f + # Wire LOGLEVEL into Gunicorn's logging config so it respects the env var + local gunicorn_level="${LOGLEVEL^^}" + sed -i '/\[logger_gunicorn\]/,/^\[/ s/^level=.*/level='"${gunicorn_level}"'/' /etc/gunicorn/logging.conf + # commands to start our main application and store its PID to check for crashes info_log "Starting backend" From 485b6af0dd66184567db37c8b6e806069ef7fd29 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sat, 11 Apr 2026 10:09:03 -0400 Subject: [PATCH 7/7] fix: wire LOGLEVEL into gunicorn logger level and RQ worker/scheduler The gunicorn logging config hard-coded level=INFO, ignoring LOGLEVEL. Patch it at startup via sed. Also pass --logging_level to rq worker and rqscheduler so their framework logging respects LOGLEVEL. Co-Authored-By: Claude Opus 4.6 (1M context) --- docker/init_scripts/init | 4 +++- entrypoint.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/init_scripts/init b/docker/init_scripts/init index 0a8ebb978..077404828 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -196,7 +196,8 @@ start_bin_rq_scheduler() { RQ_REDIS_SSL=${REDIS_SSL:-0} \ rqscheduler \ --path /backend \ - --pid /tmp/rq_scheduler.pid & + --pid /tmp/rq_scheduler.pid \ + --logging_level "${LOGLEVEL}" & } # Commands to start RQ worker @@ -219,6 +220,7 @@ start_bin_rq_worker() { --pid /tmp/rq_worker.pid \ --url "${redis_url}" \ --results-ttl "${TASK_RESULT_TTL:-86400}" \ + --logging_level "${LOGLEVEL}" \ high default low & } diff --git a/entrypoint.sh b/entrypoint.sh index 4c00c1470..949aea950 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -52,7 +52,8 @@ RQ_REDIS_HOST=${REDIS_HOST:-127.0.0.1} \ RQ_REDIS_SSL=${REDIS_SSL:-0} \ rqscheduler \ --path /app/backend \ - --pid /tmp/rq_scheduler.pid & + --pid /tmp/rq_scheduler.pid \ + --logging_level "${LOGLEVEL:-INFO}" & echo "Starting RQ worker..." # Build Redis URL properly @@ -69,6 +70,7 @@ PYTHONPATH="/app/backend:${PYTHONPATH-}" rq worker \ --path /app/backend \ --pid /tmp/rq_worker.pid \ --url "${REDIS_URL}" \ + --logging_level "${LOGLEVEL:-INFO}" \ high default low & echo "Starting watcher..."