From 47f23fcc4f328d1e69037a44332a2a84c7670401 Mon Sep 17 00:00:00 2001 From: Adam Outler Date: Mon, 22 Sep 2025 21:55:55 -0400 Subject: [PATCH 1/3] Rework Logging in restart-backend.sh The stdout and stderr are useful logs when debugging and trying to figure out why plugin output is causing backend to stop and exception. This commit enables output redirection to `/app/stdout.log` and `/app/stderr.log` from the backend. This may need backporting to production as it appears the fields are unused in the backend. Additionally, when searching logs in the UI, the old logs appear first and your search results will invariably find old information when searching with ctrl-f-"string"-enter. So upon backend start and to keep them relevant, the stdout, stderr, and app logs are cleared. --- .devcontainer/scripts/restart-backend.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/scripts/restart-backend.sh b/.devcontainer/scripts/restart-backend.sh index 3416d561..25071523 100755 --- a/.devcontainer/scripts/restart-backend.sh +++ b/.devcontainer/scripts/restart-backend.sh @@ -14,11 +14,11 @@ PORT_DEBUG=5678 sudo killall python3 2>/dev/null || true sleep 2 +echo ''|tee -a $LOG_DIR/stdout.log $LOG_DIR/stderr.log $LOG_DIR/app.log cd "$APP_DIR" # Launch using absolute module path for clarity; rely on cwd for local imports -setsid nohup ${PY} -m debugpy --listen 0.0.0.0:${PORT_DEBUG} /app/server/__main__.py >/dev/null 2>&1 & +setsid nohup ${PY} -m debugpy --listen 0.0.0.0:${PORT_DEBUG} /app/server/__main__.py 1>>/app/log/stdout.log 2>>/app/log/stderr.log & PID=$! sleep 2 - From 9dda02d430096a45fcade21666e050ecedf5faa6 Mon Sep 17 00:00:00 2001 From: Adam Outler Date: Tue, 23 Sep 2025 11:59:52 -0400 Subject: [PATCH 2/3] Modify restart script to overwrite log files --- .devcontainer/scripts/restart-backend.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/scripts/restart-backend.sh b/.devcontainer/scripts/restart-backend.sh index 25071523..8ca0c43e 100755 --- a/.devcontainer/scripts/restart-backend.sh +++ b/.devcontainer/scripts/restart-backend.sh @@ -14,7 +14,7 @@ PORT_DEBUG=5678 sudo killall python3 2>/dev/null || true sleep 2 -echo ''|tee -a $LOG_DIR/stdout.log $LOG_DIR/stderr.log $LOG_DIR/app.log +echo ''|tee $LOG_DIR/stdout.log $LOG_DIR/stderr.log $LOG_DIR/app.log cd "$APP_DIR" From d843fd4443ab294243a6031ea7f9ceea3a7c5dc6 Mon Sep 17 00:00:00 2001 From: Adam Outler Date: Tue, 23 Sep 2025 12:00:59 -0400 Subject: [PATCH 3/3] Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .devcontainer/scripts/restart-backend.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/scripts/restart-backend.sh b/.devcontainer/scripts/restart-backend.sh index 8ca0c43e..efd4bab4 100755 --- a/.devcontainer/scripts/restart-backend.sh +++ b/.devcontainer/scripts/restart-backend.sh @@ -19,6 +19,8 @@ echo ''|tee $LOG_DIR/stdout.log $LOG_DIR/stderr.log $LOG_DIR/app.log cd "$APP_DIR" # Launch using absolute module path for clarity; rely on cwd for local imports -setsid nohup ${PY} -m debugpy --listen 0.0.0.0:${PORT_DEBUG} /app/server/__main__.py 1>>/app/log/stdout.log 2>>/app/log/stderr.log & +setsid nohup "${PY}" -m debugpy --listen "0.0.0.0:${PORT_DEBUG}" /app/server/__main__.py \ + 1>>"$LOG_DIR/stdout.log" \ + 2>>"$LOG_DIR/stderr.log" & PID=$! sleep 2