Re: print in plpython not appearing in logs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ludwig Isaac Lim <ludz_lim(at)yahoo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: print in plpython not appearing in logs
Date: 2022-12-03 14:29:40
Message-ID: 2242530.1670077780@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ludwig Isaac Lim <ludz_lim(at)yahoo(dot)com> writes:
> I'm having problems wherein my print() statements inside my plpython stored proc are not appearing in postgresql log. I tried setting the file=sys.stderr

Hmm. I can tell you that with "logging_collector = on", I would only
expect the logs to capture stderr output, not stdout. So it makes
sense to me that plain "print" would disappear into the bit bucket.
But if you specify stderr output, it ought to work. I don't know
enough Python to know why it's not working, but it seems to me this is
primarily a Python question not a Postgres question. Maybe you need
an explicit fflush-equivalent step? Dunno.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brad White 2022-12-03 18:37:02 Re: Stored procedure code no longer stored in v14 and v15, changed behaviour
Previous Message Alban Hertroys 2022-12-03 11:23:17 Re: Stored procedure code no longer stored in v14 and v15, changed behaviour