Skip to content

tracing_subscriber should log to stderr #4992

Closed
@mxinden

Description

@mxinden

Summary

Diagnostics (e.g. logging) should go to stderr. Output of a program should go to stdout.

Expected behavior

tracing_subscriber to log to stderr.

Actual behavior

tracing_subscriber is logging to stdout.

Upstream bug report tokio-rs/tracing#2492

Relevant log output

No response

Possible Solution

One can easily override the default:

    let _ = tracing_subscriber::fmt()
        .with_env_filter(EnvFilter::from_default_env())
        .with_writer(std::io::stderr)
        .try_init();

Initialization of tracing_subscriber is already quite noisy. E.g. it requires 4 lines instead of the 1 line of env_logger. Should we introduce some abstraction?

Version

tracing_subscriber introduced with #4282.

Would you like to work on fixing this bug ?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions