tiberius icon indicating copy to clipboard operation
tiberius copied to clipboard

Opt out of INFO level logs

Open lanklaas opened this issue 1 year ago • 1 comments

Hello,

When using the bb8 connection pool on a service that is not used frequently, a bunch of connections get opened and closed. This causes my log to be polluted with a lot of connection info messages like below:

 2023-03-23T09:03:38.504951Z  INFO tiberius::client::connection: TLS handshake successful
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506484Z  INFO tiberius::tds::stream::token: Database change from 'mydb' to 'master'
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506504Z  INFO tiberius::tds::stream::token: Changed database context to 'mydb'.
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506510Z  INFO tiberius::tds::stream::token: SQL collation changed to windows-1252
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506526Z  INFO tiberius::tds::stream::token: Microsoft SQL Server version 2769289231
my-pod-6756bdc984-pbszf my-pod-img 2023-03-23T09:03:38.506533Z  INFO tiberius::tds::stream::token: Packet size change from '4096' to '4096'

I do not want to filter them out on a global level, but would rather prefer them to be debug events or if the info level is important, then maybe adding a feature flag to set it to debug?

I would be happy to send a PR for this

lanklaas avatar Mar 23 '23 09:03 lanklaas

If you're using something like tracing with tracing_subscriber, you can filter the output. https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/filter/struct.EnvFilter.html

These messages should be logged at a debug level, not info IMO.

olback avatar Aug 27 '23 21:08 olback