RE: unable to write 'raise' messages to log file?

From: "Ian Bell" <ib(at)ianbellsoftware(dot)com>
To: "'Adrian Klaver'" <adrian(dot)klaver(at)aklaver(dot)com>, <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RE: unable to write 'raise' messages to log file?
Date: 2018-05-31 19:18:21
Message-ID: !&!AAAAAAAAAAAYAAAAAAAAADldbAmb6+pIq6nH7MxZl07CgAAAEAAAAHOuMFMgP/pCg1Hrqz1LT5wBAAAAAA==@ianbellsoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Adrian,

Yes, if I call the function in PSQL then the expected message is displayed
the console display. Here is what is displayed in PSQL:

testdb=# select * from test.testwithbasictypearguments( 1,
2::numeric, '3' );
LOG: statement: select * from test.testwithbasictypearguments( 1,
2::numeric, '3' );
LOG: Test.TestWithArguments: i = 1, n = 2, t = 3
testwithbasictypearguments
----------------------------
0
(1 row)

testdb=#

Ian

-----Original Message-----
From: Adrian Klaver [mailto:adrian(dot)klaver(at)aklaver(dot)com]
Sent: 31 May, 2018 15:07
To: ib(at)ianbellsoftware(dot)com; pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: unable to write 'raise' messages to log file?

On 05/31/2018 11:20 AM, Ian Bell wrote:
> I am having considerable difficulty logging information in PL-pgSQL
> functions by using the ‘RAISE’ statement.    I am asking for
> comments/suggestions on what I am doing wrong.
>

>
> I’ve tried flushing/rotating the log files by executing *‘select
> pg_rotate_logfile()’* in PSQL but my messages never appear in the log
> files.   I’ve tried calling my PL-pgSQL functions in PSQL, PgAdmin4,
> OmniDB and ADO.NET but again my messages never appear in the log file.
>
> On very rare occasions, I see my messages the log file if I restart
> the PostgreSql server however restarting the server generally does not
> flush my messages to the log files.
>

Do they show up in a client? For example psql:

test_(aklaver)> create or replace function TestWithBasicTypeArguments( i
int, n numeric, t text) returns integer as $$

begin

raise log 'Test.TestWithArguments: i = %, n = %, t = %', i, n, t;

return 0;

end;

CREATE FUNCTION

test_(aklaver)> set client_min_messages = 'debug1';

test_(aklaver)> select testwithbasictypearguments(1, 2.5, 'test');
LOG: Test.TestWithArguments: i = 1, n = 2.5, t = test
testwithbasictypearguments
----------------------------
0
(1 row)

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-05-31 19:19:33 Re: unable to write 'raise' messages to log file?
Previous Message Olivier Gautherot 2018-05-31 19:15:12 Re: unable to write 'raise' messages to log file?