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

Support for Configuring Npgsql Tracing Options in NHibernate #3630

Open
sgudapa opened this issue Dec 3, 2024 · 2 comments
Open

Support for Configuring Npgsql Tracing Options in NHibernate #3630

sgudapa opened this issue Dec 3, 2024 · 2 comments

Comments

@sgudapa
Copy link

sgudapa commented Dec 3, 2024

I am using NHibernate with PostgreSQL via the Npgsql driver in our application. We are aiming to configure tracing options in Npgsql to control and eliminate specific logs emitted by Npgsql, particularly to improve our logging output and reduce noise.

The latest version of Npgsql introduces the ability to configure tracing options using the NpgsqlDataSourceBuilder API, as detailed in the Npgsql documentation:

Npgsql Tracing Documentation
However, I have encountered an issue where NHibernate's NpgsqlDriver does not seem to support configuring these tracing options. It appears that NHibernate uses NpgsqlConnection directly to create connections, without exposing a way to utilize NpgsqlDataSource or configure the tracing options.

My Questions:

  1. Is there a way to configure Npgsql tracing options within NHibernate?
  2. Can we extend or customize the NpgsqlDriver or ConnectionProvider to use NpgsqlDataSource and apply tracing configurations?
  3. Are there plans to update NHibernate to support the latest Npgsql features, including the NpgsqlDataSource API?
@sgudapa sgudapa changed the title ConfigureTracingOptions for npgsql when using Nhibernate Support for Configuring Npgsql Tracing Options in NHibernate Dec 3, 2024
@gliljas
Copy link
Member

gliljas commented Jan 2, 2025

DbDataSource is a very new concept and it's not necessarily a good fit for NHibernate (support is slim in EF too), so it's unfortunate that tracing options can only be configured that way. That said, it would certainly be possible to create a custom driver which uses NpgsqlDataSource.

@fredericDelaporte
Copy link
Member

For an example of a custom driver (but not using a datasource), you can see this project.

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

No branches or pull requests

3 participants