Redirect RAISE NOTICE and errors to separate log file

Поиск
Список
Период
Сортировка
От Nikhil Ingale
Тема Redirect RAISE NOTICE and errors to separate log file
Дата
Msg-id CALXkTpy-Nswrd1sNuKcJ-ZoUgvH24My-Ar=jXHAve=Ab-CWnCA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Redirect RAISE NOTICE and errors to separate log file  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-admin
Hi All,
I have below given procedure where I have to redirect the messages and errors to separate log files.

CREATE OR REPLACE PROCEDURE()
language plpgsql
AS $$
Declare
insrtStr character varying(5000);
BEGIN
      insrtStr := 'INSERT into test(a,b,c) SELECT * FROM demo';
      RAISE NOTICE 'insrtStr';
      EXECUTE insrtStr;
      EXCEPTION WHEN OTHERS THEN
      v_sqlerrm := sqlerrm;
   v_sqlstate := sqlstate;
    RAISE NOTICE 'exception: % %  ', v_sqlstate ,  v_sqlerrm ;
END;
$$;

psql -U postgres -d proddb -f test.sql --log-file=test.log

Reason for printing the insrtStr is to keep track of table inserts.

Above is just an example procedure. Procedure that I have written merges the data from server tables.
RAISE NOTICE logs and exceptions are printed on the console. But I want to separate out the logs.

Please provide your valuable feedback.

Thanks & Regards,
Nik

В списке pgsql-admin по дате отправления:

Предыдущее
От: MichaelDBA
Дата:
Сообщение: Re: Upgrading postgres quickly, without downtime.
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Redirect RAISE NOTICE and errors to separate log file