Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All log/tracing-log outputs have 4 spaces on the end #2979

Open
Porges opened this issue May 22, 2024 · 1 comment · May be fixed by #2980
Open

All log/tracing-log outputs have 4 spaces on the end #2979

Porges opened this issue May 22, 2024 · 1 comment · May be fixed by #2980

Comments

@Porges
Copy link

Porges commented May 22, 2024

Bug Report

When writing to tracing via log (using default-installed tracing-log handler), messages from the log macros have an additional 4 spaces appended. Messages sent via the tracing macros do not.

When using env_logger instead this does not happen.

When using json or pretty this does not happen, it only happens with full or compact.

Version

repro-tracing v0.1.0 (D:\git\repro-tracing)
├── log v0.4.21
├── tracing v0.1.40
│   ├── pin-project-lite v0.2.14
│   ├── tracing-attributes v0.1.27 (proc-macro)
│   │   ├── proc-macro2 v1.0.83
│   │   │   └── unicode-ident v1.0.12
│   │   ├── quote v1.0.36
│   │   │   └── proc-macro2 v1.0.83 (*)
│   │   └── syn v2.0.65
│   │       ├── proc-macro2 v1.0.83 (*)
│   │       ├── quote v1.0.36 (*)
│   │       └── unicode-ident v1.0.12
│   └── tracing-core v0.1.32
│       └── once_cell v1.19.0
└── tracing-subscriber v0.3.18
    ├── nu-ansi-term v0.46.0
    │   ├── overload v0.1.1
    │   └── winapi v0.3.9
    ├── sharded-slab v0.1.7
    │   └── lazy_static v1.4.0
    ├── smallvec v1.13.2
    ├── thread_local v1.1.8
    │   ├── cfg-if v1.0.0
    │   └── once_cell v1.19.0
    ├── tracing-core v0.1.32 (*)
    └── tracing-log v0.2.0
        ├── log v0.4.21
        ├── once_cell v1.19.0
        └── tracing-core v0.1.32 (*)

Platform

Windows (64-bit)

Crates

tracing-log?

Description

Repro:

main.rs:

use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt};

fn main() {
    tracing_subscriber::registry()
        .with(fmt::layer().with_ansi(false))
        .init();
    log::info!("Hello from log");
    tracing::info!("Hello from tracing");
    log::info!("Hello again from log");
    tracing::info!("Hello again from tracing");
}

Cargo.toml:

[package]
name = "repro-tracing"
version = "0.1.0"
edition = "2021"

[dependencies]
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
log = "0.4.21"

Output (end-of-line spaces represented by X):

2024-05-22T22:39:16.301618Z  INFO repro_tracing: Hello from logXXXX
2024-05-22T22:39:16.301684Z  INFO repro_tracing: Hello from tracing
2024-05-22T22:39:16.301690Z  INFO repro_tracing: Hello again from logXXXX
2024-05-22T22:39:16.301695Z  INFO repro_tracing: Hello again from tracing
@Porges
Copy link
Author

Porges commented May 23, 2024

I have a fix and will send a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant