-
Notifications
You must be signed in to change notification settings - Fork 0
fix: wire bootstrap_logging() into app startup -- enable 7-sink logging system #559
Copy link
Copy link
Closed
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedscope:smallLess than 1 day of workLess than 1 day of workspec:architectureDESIGN_SPEC Section 15 - Technical ArchitectureDESIGN_SPEC Section 15 - Technical Architecturetype:fixBug fixes and correctionsBug fixes and corrections
Description
Summary
The observability module (src/synthorg/observability/) implements a complete 7-sink structured logging system (console + synthorg.log + audit.log + errors.log + agent_activity.log + cost_usage.log + debug.log) with JSON formatting, log rotation, sensitive field redaction, correlation tracking, and per-logger name routing. None of it is active. All logs go to stdout via Uvicorn's default handler.
Root Cause
bootstrap_logging() (in synthorg.config.loader) is exported but never called. The Docker CMD runs:
CMD ["/app/.venv/bin/uvicorn", "synthorg.api.app:create_app", "--factory"]
create_app() never calls bootstrap_logging() or configure_logging(). So structlog falls through to stdlib's root handler (Uvicorn's StreamHandler), and no file sinks are created.
Scope
- Call
bootstrap_logging()increate_app()(or the Litestaron_startuphook) before any other setup - Make
log_dirconfigurable via env varSYNTHORG_LOG_DIR(default:/data/logsin Docker,logslocally) - Ensure
/data/logsis under the existingsynthorg-dataDocker volume (it already mounts/data) - Add
SYNTHORG_LOG_DIR=/data/logstodocker/.env.example - Verify all 7 sinks activate and files are created with correct routing
Acceptance Criteria
-
bootstrap_logging()is called during app initialization - All 7 default sinks are active (console + 6 files)
- Log files appear in
/data/logs/inside the container (persisted via volume) -
audit.logreceives onlysynthorg.security.*events -
agent_activity.logreceives onlysynthorg.engine.*andsynthorg.core.*events -
cost_usage.logreceives onlysynthorg.budget.*andsynthorg.providers.*events -
errors.logreceives only ERROR+ events -
debug.logreceives all DEBUG+ events - JSON format in all file sinks, colored console format on stderr
- Log rotation works (RotatingFileHandler, 10MB x 5 backups)
-
SYNTHORG_LOG_DIRenv var is respected - Tests verify logging bootstrap is called
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedscope:smallLess than 1 day of workLess than 1 day of workspec:architectureDESIGN_SPEC Section 15 - Technical ArchitectureDESIGN_SPEC Section 15 - Technical Architecturetype:fixBug fixes and correctionsBug fixes and corrections