[PR #422] [MERGED] Unify backend logging bootstrap with a single configure_logging entrypoint #727

Closed
opened 2026-03-13 21:06:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/422
Author: @AJaySi
Created: 3/12/2026
Status: Merged
Merged: 3/12/2026
Merged by: @AJaySi

Base: mainHead: codex/add-configure_logging-entrypoint


📝 Commits (1)

  • 51313f6 Unify backend logging configuration entrypoint

📊 Changes

4 files changed (+64 additions, -16 deletions)

View changed files

📝 backend/app.py (+2 -2)
📝 backend/logging_config.py (+58 -10)
📝 backend/main.py (+2 -2)
📝 backend/start_alwrity_backend.py (+2 -2)

📄 Description

Motivation

  • Centralize and modernize backend logging so both Loguru and stdlib logging use a single configurable entrypoint for normal vs verbose runs.
  • Ensure all services and third-party libraries (including warnings and exception info) are routed through the same Loguru pipeline for consistent output and formatting.

Description

  • Added configure_logging(mode, verbose, app_name) in backend/logging_config.py with a _LOGGING_CONFIGURED guard to remove existing Loguru handlers once and avoid duplicate setup.
  • Implemented LoguruInterceptHandler to forward stdlib logging records (including exc_info) into Loguru and set logging.captureWarnings(True) so warnings also flow into Loguru.
  • Preserved the normal/verbose console sinks and incorporated app_name into output formats, and set root logger handlers/level plus cleared named logger handlers and enabled propagation so logging.getLogger(...) across services goes through the same pipeline.
  • Kept setup_clean_logging() as a backward-compatible wrapper and updated startup files to call the new entrypoint: backend/app.py, backend/main.py, and backend/start_alwrity_backend.py.

Testing

  • Compiled the modified modules with python -m py_compile backend/logging_config.py backend/app.py backend/main.py backend/start_alwrity_backend.py and the compilation succeeded.
  • Verified source updates to startup files to import and call configure_logging(...) instead of the legacy setup_clean_logging() wrapper.

Codex Task


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AJaySi/ALwrity/pull/422 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/12/2026 **Status:** ✅ Merged **Merged:** 3/12/2026 **Merged by:** [@AJaySi](https://github.com/AJaySi) **Base:** `main` ← **Head:** `codex/add-configure_logging-entrypoint` --- ### 📝 Commits (1) - [`51313f6`](https://github.com/AJaySi/ALwrity/commit/51313f60dcf18a2b44cb1a72e4992f1aa5106005) Unify backend logging configuration entrypoint ### 📊 Changes **4 files changed** (+64 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `backend/app.py` (+2 -2) 📝 `backend/logging_config.py` (+58 -10) 📝 `backend/main.py` (+2 -2) 📝 `backend/start_alwrity_backend.py` (+2 -2) </details> ### 📄 Description ### Motivation - Centralize and modernize backend logging so both Loguru and stdlib `logging` use a single configurable entrypoint for normal vs verbose runs. - Ensure all services and third-party libraries (including warnings and exception info) are routed through the same Loguru pipeline for consistent output and formatting. ### Description - Added `configure_logging(mode, verbose, app_name)` in `backend/logging_config.py` with a `_LOGGING_CONFIGURED` guard to remove existing Loguru handlers once and avoid duplicate setup. - Implemented `LoguruInterceptHandler` to forward stdlib `logging` records (including `exc_info`) into Loguru and set `logging.captureWarnings(True)` so `warnings` also flow into Loguru. - Preserved the normal/verbose console sinks and incorporated `app_name` into output formats, and set root logger handlers/level plus cleared named logger handlers and enabled propagation so `logging.getLogger(...)` across services goes through the same pipeline. - Kept `setup_clean_logging()` as a backward-compatible wrapper and updated startup files to call the new entrypoint: `backend/app.py`, `backend/main.py`, and `backend/start_alwrity_backend.py`. ### Testing - Compiled the modified modules with `python -m py_compile backend/logging_config.py backend/app.py backend/main.py backend/start_alwrity_backend.py` and the compilation succeeded. - Verified source updates to startup files to import and call `configure_logging(...)` instead of the legacy `setup_clean_logging()` wrapper. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69b146700e988328aa917e27a073c796) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 21:06:09 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ALwrity#727
No description provided.