feat: daemon logging spine — rotated, timestamped, manifest-configurable#226
Merged
Conversation
Wire a real logging setup for the daemon path (start [--serve]): - LoggingConfig (level/dir/retention_days) as an additive logging: section on AppConfig — a manifest without one keeps the defaults (INFO, logs/, 14d). - configure_daemon_logging(): midnight-rotated TimedRotatingFileHandler (daemon.log, backupCount=retention_days) + a stderr StreamHandler on the root logger, ISO-8601 local timestamps with numeric UTC offset; noisy third-party namespaces (apscheduler/uvicorn/httpx/websockets) capped at WARNING; idempotent via owned-handler tagging. - _run_daemon routes its lifecycle lines through trading_bot.daemon: started/stopped log + console, per-tick line log-only, tick errors via logger.exception so tracebacks land in the file. Interactive CLI commands keep their rich-console output unchanged.
ArthurBernard
force-pushed
the
feat/daemon-log-setup
branch
from
July 14, 2026 12:37
c683249 to
6c3f32f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
daemon-loggingplan (docs: plan daemon-logging #225): a real logging spine for the daemon path —logs/daemon.logwritten by a midnight-rotating handler (14-day retention), every line ISO-8601-timestamped with the numeric tz offset, level/dir/retention configurable via the manifest's new optionallogging:section.Why
Changes
trading_bot/application/log_setup.py(new):configure_daemon_logging()— ownedTimedRotatingFileHandler(midnight,backupCount=retention_days) + stderr handler,_OffsetIsoFormatter, noisy-namespace caps, idempotent re-call.trading_bot/application/config.py:LoggingConfig(validatedlevel,dir,retention_days ≥ 1) + additivelogging:field onAppConfig.trading_bot/interfaces/cli/main.py(daemon path only): wires the setup;daemon started/stopped→ log + console, per-tick heartbeat → log only, tick errors →logger.exception(tracebacks captured). Interactive commands untouched.test_log_setup.py(new, handler wiring/idempotence/format/levels),test_config.pyextended.Changelog
Added under [Unreleased]: daemon logs are real logs — rotated, tz-offset-timestamped, manifest-configurable; tick tracebacks captured.
Test plan
python -m pytest— 1495 passed, 1 skipped, cov 96.27%ruff check trading_bot/+ruff format --checkgreendaemon.logvia the handler — started / 3 tick lines (last two exactly 60 s apart) / stopped, all+02:00-stamped; live daemon (pid 1348485, port 8000) untouched