I am having an issue with my application, one of my requirements is to capture the messages that is output in postgres when I make a call to a PLPGSQL function, similarly to what is happening here:
Get warning messages through psycopg2
Except my issues are in npgsql. I have my log manager set up:
NpgsqlLogManager.Provider = new ConsoleLoggingProvider(NpgsqlLogLevel.Trace, true, true);
And I make this call:
_db.ExecuteScalar("SELECT test_warning();");
test_warning is a custom sql function:
CREATE OR REPLACE FUNCTION test_warning()
RETURNS void AS
$BODY$
begin
raise info 'this is only a test';
end;
$BODY$
LANGUAGE plpgsql VOLATILE;
and _db
is the IDbConnection
, and the query is made using Dapper. In my log messages, I am only getting the call to the function, as well as some other connection information:
DEBUG [40560] Opened connection to (Database Server)
TRACE [40560] Start user action
TRACE [40560] ExecuteNonScalar
DEBUG [40560] Executing statement(s):
SELECT test_warning()
TRACE [40560] End user action
TRACE [40560] Closing connection
TRACE [40560] Really closing connection
DEBUG [40560] Connection closed
No mention of the warning/info message.