-
Notifications
You must be signed in to change notification settings - Fork 176
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
TraceLayer
only logs request method and path, if debug logging is enabled
#123
Comments
This is a minimally invasive fix for tower-rs#123. It's certainly not ideal, API-wise, but at least it allows users to add request information to their logs without having to set the log level to DEBUG. Close tower-rs#123
I've submitted #124 to address this. |
As @davidbarsky pointed out in #124, the existing This addresses my problem, but maybe this issue should stay open to track the weirdness of the API and resulting potential for confusion? I don't know. I'm leaving it open and letting the maintainers decide. |
I think you're right that the API is inconsistent since DefaultMakeSpan doesn't have a builder method for setting the span level. I'll review your PR tomorrow 😊 |
This is a minimally invasive fix for tower-rs#123. It's certainly not ideal, API-wise, but at least it allows users to add request information to their logs without having to set the log level to DEBUG. Close tower-rs#123
Bug Report
Version
v0.1.1
Platform
Linux 5.13.10-arch1-1 #1 SMP PREEMPT Thu, 12 Aug 2021 21:59:14 +0000 x86_64 GNU/Linux
Description
I'm configuring a
TraceLayer
like this:When executing my program with
RUST_LOG=info cargo run
, I get the following log output:The requests are logged, but the request method and path are missing.
If I run
RUST_LOG=debug cargo run
, both are there:I believe that the reason for that is that the
make_span
method is usingtracing::debug_span
, regardless of any other configuration:tower-http/tower-http/src/trace/make_span.rs
Lines 58 to 75 in e1252c2
I'm not sure what is supposed to be done here. The straight-forward fix is to add a
Level
field toDefaultMakeSpan
(along with a method to set it), but that makes no sense to me, API-wise. If I configure my requests to be logged with INFO, I don't expect to need extra steps to get basic information with my log messages.The text was updated successfully, but these errors were encountered: