Hyper(tracing) logging in env_logger maner?

I use reqwest to make HTTP requests.
And I want to see what happens under the hood.
In my application I use env_logger.
And before for debugging I just ran:

RUST_LOG=reqwest=trace,hyper=trace ./myapp

But now I see only reqwest logs.
I look at hyper code, and looks like they switched to tracing crate. Any way to redirect tracing data to stdout, if take into consideration that I do not directly depend on hyper, only via reqwest?

1 Like

You must enable a Subscriber to do anything with the log messages created by tracing, like printing them to stdout. The tracing-subscriber crate provides a good Subscriber. Re-using the RUST_LOG environment variable and showing the hyper logs should be as easy as adding the following to your code:


tracing-subscriber = { version = "^0.3.16", features = ["env-filter"] }


fn main() {

Here some more background:


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.