now getting log messages! - Mailing list pgsql-general

From Ian Bell
Subject now getting log messages!
Date
Msg-id !&!AAAAAAAAAAAYAAAAAAAAADldbAmb6+pIq6nH7MxZl07CgAAAEAAAAEQCVsuFIoNHiFGnq2+YgTMBAAAAAA==@ianbellsoftware.com
Whole thread Raw
Responses Re: now getting log messages!  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
Hello Adrian,

Your suggestions have changed something and my messages are appearing in the log file.  As per your suggestion, I
enabled' log_connections' and 'log_disconnections' and restarted the server.   

I now have something to work with.  In addition, I now know what to expect when attempting to log messages (I'm a SQL
newbie).  

Thank you for your help.

Ian


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

On 05/31/2018 12:18 PM, Ian Bell wrote:
> 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.klaver@aklaver.com]
> Sent: 31 May, 2018 15:07
> To: ib@ianbellsoftware.com; pgsql-general@lists.postgresql.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)

Hmm.

Some suggestions:/questions:
1) Enable log_connections, log_disconnections in postgresql.conf at least temporarily. This will help you see the
sessionsyou are working in 

2) Then in the session that you do:
select * from test.testwithbasictypearguments( 1, 2::numeric, '3' );
    also do:
select 1/0;
This will help also prove the logging is tracking your session or not.

3) Are you sure you do not have another postgresql.conf in the mix that is overriding your settings?


>
>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>


--
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: "Ian Bell"
Date:
Subject: RE: unable to write 'raise' messages to log file?
Next
From: Adrian Klaver
Date:
Subject: Re: now getting log messages!