Skip to content
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

Move sqlx query logging to debug level #1128

Merged
merged 1 commit into from
Jun 18, 2024
Merged

Conversation

tgeoghegan
Copy link
Contributor

By default, sea_orm::ConnectOptions will log queries at info (1). As a result, divviup-api logs are filled with unhelpful lines like:

{
    "timestamp": "2024-06-18T21:31:41.294043Z",
    "level": "INFO",
    "fields": {
        "summary": "select 1",
        "db.statement": "",
        "rows_affected": 1,
        "rows_returned": 1,
        "elapsed": "171.873\u00b5s"
    },
    "target": "sqlx::query",
    "filename": "/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-core-0.7.3/src/logger.rs",
    "line_number": 135,
    "threadId": "ThreadId(4)"
}

...which is just the healthcheck succeeding. This commit moves that logging to debug level, so that we can still opt into it but generate less noise in normal operation.

By default, `sea_orm::ConnectOptions` will log queries at info ([1]). As
a result, `divviup-api` logs are filled with unhelpful lines like:

```json
{
    "timestamp": "2024-06-18T21:31:41.294043Z",
    "level": "INFO",
    "fields": {
        "summary": "select 1",
        "db.statement": "",
        "rows_affected": 1,
        "rows_returned": 1,
        "elapsed": "171.873\u00b5s"
    },
    "target": "sqlx::query",
    "filename": "/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-core-0.7.3/src/logger.rs",
    "line_number": 135,
    "threadId": "ThreadId(4)"
}
```

...which is just the healthcheck succeeding. This commit moves that
logging to debug level, so that we can still opt into it but generate
less noise in normal operation.

[1]: https://docs.rs/sea-orm/0.12.15/sea_orm/struct.ConnectOptions.html#method.sqlx_logging_level
@tgeoghegan tgeoghegan requested a review from a team as a code owner June 18, 2024 22:07
@tgeoghegan tgeoghegan merged commit 291829d into main Jun 18, 2024
9 checks passed
@tgeoghegan tgeoghegan deleted the timg/move-sqlx-logging-debug branch June 18, 2024 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants