-
Notifications
You must be signed in to change notification settings - Fork 847
Open
Description
Bug Report
I have a simple program like
use tracing_subscriber::{filter, prelude::*, reload};
fn main() {
let (filter, reload_handle) = reload::Layer::new(filter::LevelFilter::WARN);
let fmt_layer = tracing_subscriber::fmt::layer().with_thread_ids(true);
tracing_subscriber::registry()
.with(filter)
.with(fmt_layer)
.init();
reload_handle
.modify(|filter| *filter = filter::LevelFilter::TRACE)
.unwrap();
log::debug!("log");
log::info!("log");
tracing::debug!("tracing");
tracing::info!("tracing");
}
but it looks like reload_handle.modify just modifies tracing::* level, but not the log::*.
The output of the code is
2023-09-05T13:40:44.898415Z DEBUG ThreadId(01) tracing_test: tracing
2023-09-05T13:40:44.898456Z INFO ThreadId(01) tracing_test: tracing
but I'm expecting even logs from log::{debug!, info!} after modifying the filter level to TRACE.
I'm also seeing in tracing-subscriber/src/reload.rs
// If the `log` crate compatibility feature is in use, set `log`'s max
// level as well, in case the max `tracing` level changed. We do this
// *after* rebuilding the interest cache, as that's when the `tracing`
// max level filter is re-computed.
#[cfg(feature = "tracing-log")]
tracing_log::log::set_max_level(tracing_log::AsLog::as_log(
&crate::filter::LevelFilter::current(),
));
but it seems it does not make effect even thought I have enabled appropriate feature.
[dependencies]
tracing = { version = "=0.1.37" }
tracing-subscriber = { version = "=0.3.17", features = ["env-filter", "tracing-log"] }
log = "=0.4.20"
Version
> % cargo tree | rg 'tracing|log'
tracing-test v0.1.0 (/home/nikola/tmp/tracing-test)
├── log v0.4.20
├── tracing v0.1.37
│ ├── tracing-attributes v0.1.26 (proc-macro)
│ └── tracing-core v0.1.31
└── tracing-subscriber v0.3.17
├── tracing v0.1.37 (*)
├── tracing-core v0.1.31 (*)
└── tracing-log v0.1.3
├── log v0.4.20
└── tracing-core v0.1.31 (*)
Platform
-> % uname -a
Linux enhance 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 GNU/Linux
ysndr
Metadata
Metadata
Assignees
Labels
No labels