Skip to content

fix: preserve file sinks with logging environment overrides - #1373

Merged
willkill07 merged 1 commit into
NVIDIA:release/0.10from
willkill07:fix/logging-environment-overrides
Oct 16, 2026
Merged

willkill07 merged 1 commit into
NVIDIA:release/0.10from
willkill07:fix/logging-environment-overrides

Conversation

@willkill07

@willkill07 willkill07 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Overview

Keep TOML file sinks active when logging environment variables set a level or stderr format. Managed workers can now write to their configured log files even when the launcher supplies these variables.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Load TOML logging settings first, then apply the fields set by environment variables and CLI options. Preserve file sinks, rotation settings, and flush intervals.
  • Apply the same rules to the primary daemon through [daemon.logging]. Keep explicit logging-file selection and commands that skip automatic config discovery.
  • Add tests for sink preservation, CLI precedence, explicit file selection, and actual file output with environment overrides.
  • Update the logging guide with plain-language rules and an example.

Validation: All 5,903 Rust tests passed on release/0.10, with inherited logging variables removed from the test environment. The new file-output test sets those variables itself. All staged pre-commit checks passed, including formatting, Clippy, Cargo check, dependency audits, and documentation links. Language-binding suites were not run because binding initialization is unchanged. The full documentation site build was not run; this change updates prose only.

Behavior change: Direct logging environment variables and CLI options now override individual TOML fields instead of replacing the full logging configuration. Explicit logging-file selectors keep their existing restrictions.

Where should the reviewer start?

Start with LoggingArgs::resolve_with_base in crates/cli/src/commands/logging.rs. Then review cli_logging_environment_overrides_keep_configured_file_output in crates/cli/tests/cli_tests.rs, which reproduces the missing-log-file case.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Relates to: none

Summary by CodeRabbit

  • Bug Fixes

    • Logging settings now layer over the selected configuration, so environment and command-line overrides change only the fields they specify while preserving other configured settings.
    • Explicit logging configuration paths take precedence over normal configuration discovery. CLI options can still override log level and stderr format.
    • Daemon logging configuration is now read from the [daemon.logging] table.
  • Documentation

    • Clarified logging configuration precedence and how it differs for language bindings and Rust applications.

@willkill07
willkill07 requested review from a team as code owners October 16, 2026 04:42
@github-actions github-actions Bot added size:M PR is medium Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code labels Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 73006da0-25bb-460c-82b9-c7509262ced5
📥 Commits

Reviewing files that changed from the base of the PR and between 1aeb96e and 28b67ab.

📒 Files selected for processing: 4
  • crates/cli/src/commands/logging.rs
  • crates/cli/tests/cli_tests.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • docs/reference/operational-logging.mdx

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 4 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 14
  • GitHub Check: Rust / Package (linux-musl-arm64)
  • GitHub Check: Rust / Package (linux-arm64)
  • GitHub Check: Rust / Package (windows-arm64)
  • GitHub Check: Rust / Test (windows-arm64)
  • GitHub Check: Rust / Package (linux-amd64)
  • GitHub Check: Rust / Package (windows-amd64)
  • GitHub Check: Rust / Package (linux-musl-amd64)
  • GitHub Check: Rust / Test (macos-arm64)
  • GitHub Check: Rust / Package (macos-arm64)
  • GitHub Check: Rust / Test (linux-arm64)
  • GitHub Check: Rust / Test (linux-amd64)
  • GitHub Check: Rust / Test (windows-amd64)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📚 Code guidelines: 5
.agents/skills/contribute-docs/SKILL.md — configured
.agents/skills/review-doc-style/SKILL.md — configured
CONTRIBUTING.md — configured
.agents/skills/prepare-code-freeze/SKILL.md — configured
.agents/skills/draft-release-notes/SKILL.md — configured
📓 Path-based instructions: 7
Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.

⚙️ CodeRabbit configuration file

Files:

  • docs/reference/operational-logging.mdx
Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.

⚙️ CodeRabbit configuration file

Files:

  • crates/cli/tests/cli_tests.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
Source excerpt: In MDX files, top-of-file comments must use JSX comment delimiters: `{/*` to open and `*/}` to close.

📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)

Files:

  • docs/reference/operational-logging.mdx
Source excerpt: Verify MDX files use JSX delimiters for top-of-file SPDX comments.

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

Files:

  • docs/reference/operational-logging.mdx
Applicability reference: AGENTS.md: # NeMo Relay Repository Guidance See `CONTRIBUTING.md` and `docs/contribute/testing-and-docs.mdx` for contributor details, and `.agents/skills/README.md` for the maintainer skill boundary.

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • crates/cli/tests/cli_tests.rs
  • crates/cli/tests/coverage/commands/main_tests.rs
  • crates/cli/src/commands/logging.rs
Source excerpt: Search documentation source for references to the old version and update current-version install commands, package examples, and configuration examples to `` where appropriate: Review matches before changing th...

📄 CodeRabbit inference engine (.agents/skills/prepare-code-freeze/SKILL.md)

Files:

  • docs/reference/operational-logging.mdx
Source excerpt: Preserve MDX front matter and the JSX SPDX comment.

📄 CodeRabbit inference engine (.agents/skills/draft-release-notes/SKILL.md)

Files:

  • docs/reference/operational-logging.mdx
🔇 Additional comments: 5
crates/cli/src/commands/logging.rs: 2

41-46: LGTM!

Also applies to: 49-78, 100-108

84-97: 🎯 Functional Correctness

The proposed refactor is not required for this behavior. environment_value rejects empty and non-Unicode values, and from_environment() propagates those errors before the overlay runs. For valid values, env::var(...).is_some() and env::var_os(...).is_some() agree with the checks in resolve_with_base.

The repeated environment names are a maintainability concern only. No functional mismatch remains.

crates/cli/tests/cli_tests.rs: 1

376-412: LGTM!

crates/cli/tests/coverage/commands/main_tests.rs: 1

787-787: LGTM!

Also applies to: 801-801, 808-872, 956-1000

docs/reference/operational-logging.mdx: 1

93-121: LGTM!

Walkthrough

CLI logging resolution now layers environment and CLI overrides over a selected base configuration. Tests and documentation cover the precedence rules, explicit config paths, and daemon configuration.

Changes

CLI logging configuration

Layer / File(s) Summary
Logging resolution and override precedence
crates/cli/src/commands/logging.rs
Regular, daemon, and no-ambient-config resolution use a shared override flow. Explicit config paths select the base file. Environment values override their corresponding fields, and CLI level and stderr-format options apply last.
Precedence tests and operational logging documentation
crates/cli/tests/cli_tests.rs, crates/cli/tests/coverage/commands/main_tests.rs, docs/reference/operational-logging.mdx
Tests cover environment overrides, file sinks, and explicit config paths. The reference documents source precedence, daemon logging configuration, and binding startup behavior.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI options
  participant Resolver as logging resolver
  participant Config as base config loader
  participant Env as environment logging settings
  CLI->>Resolver: resolve logging configuration
  alt Explicit config path supplied
    Resolver->>Config: load selected file directly
  else No explicit config path
    Resolver->>Env: read environment logging settings
    alt Named environment config path supplied
      Env->>Config: load selected file directly
    else No named environment config path
      Resolver->>Config: load regular or daemon base config
    end
  end
  Resolver->>Resolver: apply environment field overrides, then CLI overrides
Loading
Merge Risk: ⚪ Minimal · up to 28b67

The explicit logging-file option retains its documented precedence. No merge-blocking issue was established.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title follows Conventional Commits format, uses the allowed lowercase type fix, clearly describes the logging change, stays under 72 characters, and has no trailing period.
Description check Passed The description includes the required Overview, Details, reviewer-start, and Related Issues sections. It explains the behavior change, testing, validation limits, and review entry points. The Related …
Docstring Coverage Passed Docstring coverage is 92.86% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 3 files. (1 skipped: 1 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

@willkill07 willkill07 self-assigned this Oct 16, 2026
@willkill07 willkill07 added this to the 0.10 milestone Oct 16, 2026
@willkill07
willkill07 merged commit 30940d0 into NVIDIA:release/0.10 Oct 16, 2026
46 checks passed
@willkill07
willkill07 deleted the fix/logging-environment-overrides branch October 30, 2026 14:46

This branch was previously deployed

1 inactive deployment
fern — 28b67abd Deployed Oct 16, 2026 by willkill07 via Clean up docs preview #5885
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code size:M PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants