Skip to content

Specify log directory path of structured logs #16696

Description

@weihanglo

Problem

Currently, when -Zbuild-analysis is enabled, Cargo writes log files, to ~/.cargo/log directly. This is good enough for a prototype but not ideal for stabilization.

We would like to have a way to configure the location of log files, and perhaps also have a way to write to stdout. Here are some use cases:

Proposed Solution

The easiest way to implement it is adding a config file to specify log directory location to the [build.analysis] table. For example,

[build.analysis]
enabled = true
log-dir = "<directory-path>"

However, we have discussed that the structured logging might be more general that build analysis, and might be renamed to the [log] table. The field name log-path feels redundant when under log table. (Another issue of using [log] table is that it might conflict with CARGO_LOG env var, though that is a bit out of scope here).

We also need to consider if we want to support streaming to stdout, for example, a special - to stream to stdout.

Notes

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-build-analysisNightly: build-analysis

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions