Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: debug logging now visible on stderr when LDR_APP_DEBUG=true (#2761)

LearningCircuitb524bd9a4513
diff --git a/scripts/dev/restart_server_debug.sh b/scripts/dev/restart_server_debug.sh
new file mode 100755
index 0000000000..283ae31a0c
--- /dev/null
+++ b/scripts/dev/restart_server_debug.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# Script to restart the LDR server with DEBUG logging enabled.
+#
+# WARNING: Debug logs may contain sensitive data (queries, answers, API responses).
+# This is for local development and feature testing only.
+# Do NOT use in production or with real user data.
+
+echo "Stopping existing LDR server..."
+pkill -f "python -m local_deep_research.web.app" 2>/dev/null || echo "No existing server found"
+
+# Wait a moment for the process to stop
+sleep 1
+
+echo "Starting LDR server in DEBUG mode..."
+# Change to the script's parent directory (project root)
+cd "$(dirname "$0")/../.." || exit 1
+
+# Start server in background and detach from terminal
+(nohup env LDR_APP_DEBUG=true LDR_LOG_SETTINGS=summary pdm run python -m local_deep_research.web.app > /tmp/ldr_server.log 2>&1 &) &
+SERVER_PID=$!
+
+# Give it a moment to start
+sleep 2
+
+echo "Server started. PID: $SERVER_PID"
+echo "Logs: /tmp/ldr_server.log"
+echo "URL: http://127.0.0.1:5000"
+echo ""
+echo "WARNING: Running in DEBUG mode (LDR_APP_DEBUG=true)"
+echo " - Debug logs may contain sensitive data (queries, answers, API responses)"
+echo " - For local development and feature testing only"
+echo " - Do NOT use in production or with real user data"
+echo ""
+echo "To check server status: ps aux | grep 'python -m local_deep_research.web.app'"
+echo "To view logs: tail -f /tmp/ldr_server.log"
+echo "To stop server: pkill -f 'python -m local_deep_research.web.app'"
+
+# Exit immediately - don't wait for background process
+exit 0
diff --git a/src/local_deep_research/utilities/log_utils.py b/src/local_deep_research/utilities/log_utils.py
index 17b62dab8d..0d5fbe2731 100644
--- a/src/local_deep_research/utilities/log_utils.py
+++ b/src/local_deep_research/utilities/log_utils.py
@@ -276,10 +276,18 @@ def config_logger(name: str, debug: bool = False) -> None:
logger.remove()
# Log to console (stderr) and database
- logger.add(sys.stderr, level="INFO", diagnose=debug)
+ stderr_level = "DEBUG" if debug else "INFO"
+ logger.add(sys.stderr, level=stderr_level, diagnose=debug)
logger.add(database_sink, level="DEBUG", diagnose=debug)
logger.add(frontend_progress_sink, diagnose=debug)
+ if debug:
+ logger.warning(
+ "DEBUG logging is enabled (LDR_APP_DEBUG=true). "
+ "Logs may contain sensitive data (queries, answers, API responses). "
+ "Do NOT use in production."
+ )
+
# Optionally log to file if enabled (disabled by default for security)
# Check environment variable first, then database setting
enable_file_logging = (