From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ludwig Isaac Lim <ludz_lim@yahoo.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: print in plpython not appearing in logs
Date: Sat, 03 Dec 2022 09:29:40 -0500
Message-ID: <2242530.1670077780@sss.pgh.pa.us> (raw)
In-Reply-To: <1649936435.214554.1669982358413@mail.yahoo.com>
References: <1649936435.214554.1669982358413.ref@mail.yahoo.com>
<1649936435.214554.1669982358413@mail.yahoo.com>
Ludwig Isaac Lim <ludz_lim@yahoo.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
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: tgl@sss.pgh.pa.us, ludz_lim@yahoo.com
Subject: Re: print in plpython not appearing in logs
In-Reply-To: <2242530.1670077780@sss.pgh.pa.us>
References: <1649936435.214554.1669982358413.ref@mail.yahoo.com> <1649936435.214554.1669982358413@mail.yahoo.com> <2242530.1670077780@sss.pgh.pa.us>
* 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