Search code examples
postgresqlnpgsql

NPGSQL Logging from SP


I am using a Console app and VB.NET to connect to a Postgres database. We run lots of stored procedures with various levels of information.

Dim varloggerFactory = LoggerFactory.Create(Function(builder) builder.AddConsole().SetMinimumLevel(LogLevel.Debug)) NpgsqlLoggingConfiguration.InitializeLogging(varloggerFactory)

Inside our SPs we use various warning levels.

RAISE INFO 'This is info!';
RAISE DEBUG 'This is debug!';
RAISE WARNING 'This is warning!';
RAISE NOTICE 'DOES THIS SHOW UP IN THE TEXT?';
RAISE EXCEPTION 'This is an error message';

Unfortunately these all come into the logging as Debug Statements except for the Raise Exception.

dbug: Npgsql.Connection[1301] Received notice: This is info! dbug: Npgsql.Connection[1301] Received notice: This is warning! dbug: Npgsql.Connection[1301] Received notice: DOES THIS SHOW UP IN THE TEXT?

Is there a way for NPGSQL to put them on the level they were raised in the SP?


Solution

  • No, that's not currently possible - can you please open an issue on https://github.com/npgsql/npgsql to request this?