1
내 응용 프로그램에 문제가 있습니다. 내 요구 사항 중 하나는 PLPGSQL 함수를 호출 할 때 postgres에서 출력되는 메시지를 캡처하는 것과 같습니다 (npgsql을 통해 postgres 메시지 받기
).Get warning messages through psycopg2
내 문제는 npgsql을 제외하고. 나는 내 로그 관리자가 설정 한 :
NpgsqlLogManager.Provider = new ConsoleLoggingProvider(NpgsqlLogLevel.Trace, true, true);
그리고이 호출합니다
_db.ExecuteScalar("SELECT test_warning();");
test_warning 사용자 정의 SQL 함수입니다 :
CREATE OR REPLACE FUNCTION test_warning()
RETURNS void AS
$BODY$
begin
raise info 'this is only a test';
end;
$BODY$
LANGUAGE plpgsql VOLATILE;
및 _db
가 IDbConnection
입니다, 그리고 쿼리는 Dapper를 사용하여 수행됩니다. 경고/정보 메시지의
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
없음 언급 : 내 로그 메시지에서, 난 단지 함수의 호출뿐만 아니라 다른 연결 정보를 얻고있다.
[공지 처리 (https://www.postgresql.org/ docs/current/static/libpq-notice-processing.html) 연결 핸들러에 접근 할 수 있다면 간단합니다. – Abelisto