Skip to content

log feature emits logs when the log crate doesn't, ignoring log::max_level() #856

Closed
@Florob

Description

@Florob

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 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.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate/tracingRelated to the `tracing` cratekind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions