Skip to main content
Version: 1.0.x 🚧

Debug Log

SeaORM logs debug messages via the tracing crate.

You can enable SeaORM's logging with the debug-print feature flag:

version = "0.12"
features = ["debug-print"]

You need to setup tracing-subscriber to capture and view the debug log. See the snippet below and a complete example here.

pub async fn main() {

// ...

SeaORM's debug print injects parameters into the SQL string, which makes it easier to read. Instead of seeing SELECT "chef"."name" FROM "chef" WHERE "chef"."id" = $1, you will see SELECT "chef"."name" FROM "chef" WHERE "chef"."id" = 100.

SQLx Logging

SQLx also logs by default. If you turned on SeaORM's debug-print, you can disable SQLx's log by passing ConnectOptions to connect().

let mut opt = ConnectOptions::new("protocol://username:password@host/database".to_owned());
.sqlx_logging(false) // Disable SQLx log
.sqlx_logging_level(log::LevelFilter::Info); // Or set SQLx log level

let db = Database::connect(opt).await?;