Skip to content

Cargo should use a variable other than RUST_LOG for env_logger. #6189

Closed
@zachlute

Description

@zachlute

Suggestion: CARGO_LOG.

This came up during the Debugging session at Rust Belt Rust. Basically, as soon as people set up their project to use env_logger and set RUST_LOG=debug, they were super confused by the crazy amount of seemingly-random output suddenly on their screen, which appeared to include parse tokens of some sort? The same problem exists at the info level, though obviously to a lesser extent.

While it makes sense for most things to just use RUST_LOG, and it's true that you can solve this problem by specifying a module filter for env_logger, it seems like a common and confusing enough behavior, and a likely enough case that somebody would do RUST_LOG=debug cargo run and get a whole bunch of confusing output, that it likely makes sense to just use a different variable for Cargo.

In fact, while working on a potential PR for this, it happened again to the guy sitting next to me. "What the heck is all this crazy output?" He wasn't a plant or anything!

The only potential downside here is if people expect RUST_LOG to work and it doesn't, but I suspect the number of workflows this would break is vanishingly small and it's a simple fix, so maybe that's not a big deal?

Anyway, PR coming shortly for feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions