Closed as not planned
Description
Bug Description
I have enabled statement logging and then run a query, but the statement isn't logged.
Minimal Reproduction
#[tokio::main]
async fn main() -> Result<(), sqlx::Error> {
let db_url = env::var("DB_URL").expect("Missing DB_URL env var");
let connect_options = PgConnectOptions::from_str(&db_url)?
.ssl_mode(sqlx::postgres::PgSslMode::Prefer)
.log_statements(LevelFilter::Trace);
let pool = PgPoolOptions::new()
.max_connections(5)
.connect_with(connect_options)
.await?;
let res = sqlx::query("SELECT 5+6 AS sum;").fetch_one(&pool).await?;
let sum: i32 = res.get("sum");
println!("Hi, the sum is: {sum}");
Ok(())
}
Output:
$ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
Running `target/debug/myapp`
Hi, the sum is: 11
$
Info
- SQLx version: "0.7.3"
- SQLx features enabled: ["postgres", "runtime-tokio-rustls"]
- Database server and version: Postgres 15.1
- Operating system: macOS
rustc --version
: rustc 1.75.0 (82e1608df 2023-12-21)
Discussion
I am new to Rust and sqlx, so I'm probably doing something wrong! But I can't figure out what that is, and I don't see any discussion of logging in the README.