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.
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
Bug Report
When writing to
tracing
vialog
(using default-installedtracing-log
handler), messages from thelog
macros have an additional 4 spaces appended. Messages sent via thetracing
macros do not.When using
env_logger
instead this does not happen.When using
json
orpretty
this does not happen, it only happens withfull
orcompact
.Version
Platform
Windows (64-bit)
Crates
tracing-log
?Description
Repro:
main.rs
:Cargo.toml
:Output (end-of-line spaces represented by
X
):