Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1TWS-0001eo-Pm for pgsql-general@arkaria.postgresql.org; Sat, 03 Dec 2022 14:29:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p1TWR-00058T-IQ for pgsql-general@arkaria.postgresql.org; Sat, 03 Dec 2022 14:29:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1TWR-00057q-7m for pgsql-general@lists.postgresql.org; Sat, 03 Dec 2022 14:29:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1TWP-0003TN-3q for pgsql-general@postgresql.org; Sat, 03 Dec 2022 14:29:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2B3ETe6b2242531; Sat, 3 Dec 2022 09:29:40 -0500 From: Tom Lane To: Ludwig Isaac Lim cc: "pgsql-general@postgresql.org" Subject: Re: print in plpython not appearing in logs In-reply-to: <1649936435.214554.1669982358413@mail.yahoo.com> References: <1649936435.214554.1669982358413.ref@mail.yahoo.com> <1649936435.214554.1669982358413@mail.yahoo.com> Comments: In-reply-to Ludwig Isaac Lim message dated "Fri, 02 Dec 2022 11:59:18 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2242529.1670077780.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 03 Dec 2022 09:29:40 -0500 Message-ID: <2242530.1670077780@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ludwig Isaac Lim writes: > I'm having problems wherein my print() statements inside my plpython sto= red proc are not appearing in postgresql log. I tried setting the file=3Ds= ys.stderr Hmm. I can tell you that with "logging_collector =3D 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