`torrust-tracker` daemon: JSON logs on stderr and JSON startup failure

未关闭
#2,766 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust

调研方向

Read the two referenced ADRs, then inspect the logging initializers in packages/configuration/src/v3_0_0/logging.rs, older configuration versions, and src/logging.rs, plus src/main.rs. The issue requires a maintainer decision on the public trace_style migration before implementation; inspect src/console/ci/e2e/logs_parser.rs and its tests, and search the named docs and test helpers for log readers. Done means stderr is JSON lines, stdout is empty, startup failures emit one JSON record and exit 1, and the parser and operator documentation match.

由索引模型根据 Issue 内容生成。

描述

Part of EPIC #2758. Order 7 of 11, wave 1.

Goal

The daemon writes its tracing output as JSON lines on stderr by default and reports a startup failure as a JSON record, as the contract requires of a no-stdout-result daemon.

Background

packages/configuration/src/v3_0_0/logging.rs (and the older versions and src/logging.rs) initialize tracing_subscriber::fmt() with with_test_writer() and ANSI, which writes to stdout in the full style by default (trace_style, default Full). src/main.rs reports startup failure with eprintln!("Tracker startup failed: {error}"). The contract requires tracing on stderr as NDJSON, nothing on stdout. Maintainer decision (2026-11-06): migrate now, not deferred. This is operator-visible just after the 3.0.0 release: deployments that parse the plain text or read stdout break. The trace_style option and config schema versions are public, so decide the migration detail with the maintainer before writing code (default json versus keeping trace_style meaning, stream, ANSI, deprecation of the other styles, versioned-config handling) and record it, with an ADR if it is a material decision. The e2e runner parses the container logs in src/console/ci/e2e/logs_parser.rs; that parser must follow the new format. Search for other readers of log text (docs/benchmarking.md, container docs, tests with with_test_writer).

The contract in short: see the ADRs docs/adrs/20260519000000_define_global_cli_output_contract.md and docs/adrs/20261106102632_scope_the_cli_output_contract_and_keep_exit_codes_to_zero_one_two.md.

In scope

  • Send tracing output to stderr; leave stdout empty.
  • Make JSON the default style (or the agreed alternative) and keep the other trace_style values only if the decision keeps them.
  • Startup failure as one JSON record on stderr, exit 1; usage and config errors exit 2 if they are usage errors.
  • Update logs_parser.rs and its tests; update docs, default configs and the changelog or release-note convention.
  • Keep test-helper logging working (packages/test-helpers/src/logging.rs).

Out of scope

  • The e2e runners' own logging (EPIC issue 10).
  • Changing log levels or thresholds.

Acceptance criteria

  • Running the tracker writes nothing to stdout.
  • Every stderr line is a JSON object.
  • A startup failure prints one JSON record and exits 1.
  • logs_parser.rs and its tests follow the new format.
  • The operator-visible change is documented.

The full specification (implementation plan, verification plan, files this issue may touch) is added by the spec PR under docs/issues/open/.

主要语言
Rust
星标
532
派生
56
平均合并
11 小时 20 分钟
30 天内合并 PR
282

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

torrust/torrust-tracker 的其他 Issue

查看 torrust/torrust-tracker 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。