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
Hi, I'm trying to set up logging/tracing. But it seems to be not working at all. I feel like I'm doing something completely wrong cause in all other frameworks I've used in my experience it wasn't a problem at all, I was even configuring logging. But here it seems like it just traces nothing no matter what features I toggle or what example from the docs I implement
So, here's my deps:
axum = { version = "0.6.20", features = ["tracing"]}
tokio = { version = "1.33.0", features = ["full"] }
tower-http = { version = "0.4.4", features = ["trace"] }
tracing = "0.1.40"tracing-subscriber = { version = "0.3.17", features = ["env-filter"]}
And my code:
use std::net::{IpAddr,Ipv4Addr,SocketAddr};use axum::{routing::get,Router};use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};constADDR:SocketAddr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0,0,0,0)),8080);#[tokio::main]asyncfnmain(){
tracing_subscriber::registry().with(
tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {"my_app=debug,tower_http=debug,axum::rejection=trace".into()}),).with(tracing_subscriber::fmt::layer()).init();// build our application with a single routelet app = Router::new().route("/",get(|| async{"Hello, World!"}));// run it
tracing::debug!("listening on {ADDR}");
axum::Server::bind(&ADDR).serve(app.into_make_service()).await.unwrap();}
So here I got a debug message that... doesn't print anything. And it doesn't print anything also no matter whether I try to change to tracing::info! or to tracing::error!. And it doesn't print anything on requests.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm trying to set up logging/tracing. But it seems to be not working at all. I feel like I'm doing something completely wrong cause in all other frameworks I've used in my experience it wasn't a problem at all, I was even configuring logging. But here it seems like it just traces nothing no matter what features I toggle or what example from the docs I implement
So, here's my deps:
And my code:
So here I got a debug message that... doesn't print anything. And it doesn't print anything also no matter whether I try to change to
tracing::info!
or totracing::error!
. And it doesn't print anything on requests.What am I missing?
Beta Was this translation helpful? Give feedback.
All reactions