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.

feat: Add configurable file logging with security warning

LearningCircuit1cd37e64bf2f
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.json
index e8a7b69fd2..618211c9df 100644
--- a/src/local_deep_research/defaults/default_settings.json
+++ b/src/local_deep_research/defaults/default_settings.json
@@ -55,6 +55,20 @@
"value": true,
"visible": true
},
+ "app.enable_file_logging": {
+ "category": "app_interface",
+ "description": "Enable logging to files (WARNING: Log files are unencrypted and may contain sensitive data)",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Enable File Logging",
+ "options": null,
+ "step": null,
+ "type": "APP",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
"app.host": {
"category": "app_interface",
"description": "Host address to bind the web server",
diff --git a/src/local_deep_research/utilities/log_utils.py b/src/local_deep_research/utilities/log_utils.py
index 9852524f4e..c105c1b701 100644
--- a/src/local_deep_research/utilities/log_utils.py
+++ b/src/local_deep_research/utilities/log_utils.py
@@ -7,6 +7,7 @@ from __future__ import annotations
import inspect
import logging
+import os
import queue
import sys
import threading
@@ -264,11 +265,43 @@ def config_logger(name: str) -> None:
logger.enable("local_deep_research")
logger.remove()
- # Log to console (stderr) and database - no file output
+ # Log to console (stderr) and database
logger.add(sys.stderr, level="INFO")
logger.add(database_sink, level="DEBUG")
logger.add(frontend_progress_sink)
+ # Optionally log to file if enabled (disabled by default for security)
+ # Check environment variable first, then database setting
+ enable_file_logging = (
+ os.environ.get("LDR_ENABLE_FILE_LOGGING", "").lower() == "true"
+ )
+
+ if not enable_file_logging:
+ # Try to get from database settings if available
+ try:
+ from .db_utils import get_setting_from_db_main_thread
+
+ enable_file_logging = get_setting_from_db_main_thread(
+ "app.enable_file_logging", False
+ )
+ except Exception:
+ # Database not available yet, stick with default
+ pass
+
+ if enable_file_logging:
+ log_file = _LOG_DIR / f"{name}.log"
+ logger.add(
+ log_file,
+ level="DEBUG",
+ rotation="10 MB",
+ retention="7 days",
+ compression="zip",
+ )
+ logger.warning(
+ f"File logging enabled - logs will be written to {log_file}. "
+ "WARNING: Log files are unencrypted and may contain sensitive data!"
+ )
+
# Add a special log level for milestones.
try:
logger.level("MILESTONE", no=26, color="<magenta><bold>")