You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linux 4.19.0-xilinx #2 SMP PREEMPT Wed Jul 22 19:10:58 CEST 2020 armv7l GNU/Linux
Description
I was surprised by hyper emitting Trace level logs in conjunction with the syslog crate, while the level filter was set to Info. This turned out to be caused by hyper using the tracing crate instead of the log crate directly. In particular log::max_level() seems to be ignored.
In tracing/macros.rstracing_log!() computes whether to log differently from the log crate.
While the log crate checks for lvl <= log::STATIC_MAX_LEVEL && lvl <= log::max_level(), tracing instead checks for lvl <= log::STATIC_MAX_LEVEL and later the output of logger.enabled(). This causes differences in what is being logged including unexpected log output.
The text was updated successfully, but these errors were encountered:
In `tracing/macros.rs` `tracing_log!()` computes whether to log
differently from the log crate.
While the log crate checks for `lvl <= log::STATIC_MAX_LEVEL && lvl <=
log::max_level()`, tracing instead checks for `lvl <=
log::STATIC_MAX_LEVEL` and later the output of `logger.enabled()`. This
causes differences in what is being logged including unexpected log
output.
Since most of our testing has been with `env_logger`, we missed this
issue, since `env_logger` will also return `false` from its `enabled`
method for any records below the max level. However, other loggers may
not. Also, `enabled` is more expensive than checking the max level, so
this should result in better filtering performance for `log` records
emitted by tracing.
Fixes#856
Signed-off-by: Eliza Weisman <[email protected]>
## Motivation
In `tracing/macros.rs` `tracing_log!()` computes whether to log
differently from the log crate.
While the log crate checks for `lvl <= log::STATIC_MAX_LEVEL && lvl <=
log::max_level()`, tracing instead checks for `lvl <=
log::STATIC_MAX_LEVEL` and later the output of `logger.enabled()`. This
causes differences in what is being logged including unexpected log
output.
Since most of our testing has been with `env_logger`, we missed this
issue, since `env_logger` will also return `false` from its `enabled`
method for any records below the max level. However, other loggers may
not. Also, `enabled` is more expensive than checking the max level, so
this should result in better filtering performance for `log` records
emitted by tracing.
## Solution
This commit...fixes that.
Fixes#856
Signed-off-by: Eliza Weisman <[email protected]>
Bug Report
Version
0.1.16, seems to be no different on master
Platform
Linux 4.19.0-xilinx #2 SMP PREEMPT Wed Jul 22 19:10:58 CEST 2020 armv7l GNU/Linux
Description
I was surprised by hyper emitting
Trace
level logs in conjunction with the syslog crate, while the level filter was set toInfo
. This turned out to be caused by hyper using the tracing crate instead of the log crate directly. In particularlog::max_level()
seems to be ignored.In
tracing/macros.rs
tracing_log!()
computes whether to log differently from the log crate.While the log crate checks for
lvl <= log::STATIC_MAX_LEVEL && lvl <= log::max_level()
, tracing instead checks forlvl <= log::STATIC_MAX_LEVEL
and later the output oflogger.enabled()
. This causes differences in what is being logged including unexpected log output.The text was updated successfully, but these errors were encountered: