-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
better log messages for elapsed time warn
s
#2669
Comments
Why would it be a random |
I have already configured the log level for sqlx to be debug through the |
You need to set the different log levels on sqlx. Along
|
I see. Thanks. Though I still think the messages can be improved, so I think the issue still stands. |
I agree. It may be intuitive to you @Matthias247 because you know the slow_statement is the only kind of event that is logged at WARN level or so, but every time I see it I always have to think twice about what it is WARNing me for. |
We were also surprised to suddenly see new warnings and didn't know what changed (did we update the library? Something else in our debug/warn setup?). Having the log prefixed with "Slow query:" or something like that would help us to diagnose the root cause way faster. |
Is your feature request related to a problem? Please describe.
When the elapsed time for a query goes over some amount, there is a log for a warn. The message then only contained the query itself and again in another field a truncated version of the query.
Describe the solution you'd like
A clear "query took too long" in one of those fields would help convey what might seem like a random warn. The time was already a problem, but was known, and time was spent trying to figure out if there was another issue at play.
Describe alternatives you've considered
As its the library itself that has the logging, there is nothing I can do as long query times are not an error that can be matched on.
Additional context
version 0.7.1
postgres 15
Looks like this is the line where the logic for the log happens:
sqlx/sqlx-core/src/logger.rs
Lines 86 to 93 in 7e7dded
The text was updated successfully, but these errors were encountered: