pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: ib@ianbellsoftware.com
To: pgsql-general@lists.postgresql.org
Subject: Re: unable to write 'raise' messages to log file?
Date: Thu, 31 May 2018 12:07:18 -0700
Message-ID: <91ee1e5f-171c-cbad-601a-d98ba97d42a9@aklaver.com> (raw)
In-Reply-To: <!&!AAAAAAAAAAAYAAAAAAAAADldbAmb6+pIq6nH7MxZl07CgAAAEAAAAKg/AOTHwA5Fj0N12IA50xYBAAAAAA==@ianbellsoftware.com>
References: <!&!AAAAAAAAAAAYAAAAAAAAADldbAmb6+pIq6nH7MxZl07CgAAAEAAAAKg/AOTHwA5Fj0N12IA50xYBAAAAAA==@ianbellsoftware.com>

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.klaver@aklaver.com




view thread (8+ messages)  latest in thread

Message-ID: <91ee1e5f-171c-cbad-601a-d98ba97d42a9@aklaver.com>
Permalink:  ../91ee1e5f-171c-cbad-601a-d98ba97d42a9@aklaver.com/
Also on:    postgresql.org/message-id/91ee1e5f-171c-cbad-601a-d98ba97d42a9@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, ib@ianbellsoftware.com
  Subject: Re: unable to write 'raise' messages to log file?
  In-Reply-To: <91ee1e5f-171c-cbad-601a-d98ba97d42a9@aklaver.com>
  References: <!&!AAAAAAAAAAAYAAAAAAAAADldbAmb6+pIq6nH7MxZl07CgAAAEAAAAKg/AOTHwA5Fj0N12IA50xYBAAAAAA==@ianbellsoftware.com> <91ee1e5f-171c-cbad-601a-d98ba97d42a9@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox