fix(backend): emit app.* INFO logs to stdout on the API process (#1926) #1941
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#1941
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/1926-app-log-stdout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Что
App-level логи (
logging.getLogger("app.*")) не имели StreamHandler → их INFO терялся:docker logs gendesign-backend-1показывал только uvicorn-логгеры. Полезные строки («OSRM road-distance applied», RBAC, analyze, zone-regulation) были невидимы при отладке на VPS (в Sentry/GlitchTip они шли breadcrumb'ами, но не в stdout). Особенно мешает после флипа OSRM (#39) — не видно fallback-rate и применение.Как
main.pyвешает один StreamHandler на корневой"app"логгер на уровнеAPP_LOG_LEVEL(default INFO):uvicorn*логгеры сpropagate:false) — подтверждено ревьюером дампом uvicorn LOGGING_CONFIG._gd_app_streamguard против дубля при uvicorn--reload/ повторном импорте.celery_app.py) НЕ тронут — там loader'ы чатятся per-sync, INFO бы зашумил.parcels.py— 3logger.info), не per-row.Проверки
ruff✅ · новыйtests/test_app_logging.py(handler present + level INFO + propagate intact) +test_health✅.code-reviewer: ✅ APPROVE, 0 critical — load-bearing «no double-emit» проверен дампом uvicorn config (root без stdout-хендлера); Sentry intact; идемпотентность; flood-safety; attr-trick валиден.Пост-деплой verify (закрывает no-double-emit + Sentry-intact в проде): после одного
/analyzeвdocker logs gendesign-backend-1появится строка app.* INFO («OSRM road-distance applied») ровно один раз + breadcrumb в GlitchTip.Refs #1926
App-level logs (logging.getLogger("app.*")) had no StreamHandler, so their INFO was lost — `docker logs gendesign-backend-1` showed only uvicorn loggers. Useful lines (e.g. "OSRM road-distance applied", RBAC, analyze) were invisible when debugging on the VPS (only Sentry/GlitchTip received them as breadcrumbs). main.py now attaches one StreamHandler to the root "app" logger at APP_LOG_LEVEL (default INFO), idempotent (marker guard), propagate=True so the Sentry LoggingIntegration on root still gets breadcrumbs/events and there's no stdout double (root has no stdout handler). API process only — celery worker (celery_app.py) untouched, since its loaders log per-sync and would be noisy. Flood-safe on the API: the analyze hot path logs INFO per-request (parcels.py has 3 logger.info), not per-row. Adds tests/test_app_logging.py (handler present, level INFO, propagate intact). Refs #1926