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 1mmhSK-0007fq-Hh for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Nov 2021 19:15:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mmhRo-0005zH-45 for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Nov 2021 19:15:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmhRn-0005z8-2k for pgsql-hackers@lists.postgresql.org; Mon, 15 Nov 2021 19:15:19 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmhRi-0007w0-En for pgsql-hackers@lists.postgresql.org; Mon, 15 Nov 2021 19:15:18 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A8BD75C02C2; Mon, 15 Nov 2021 14:15:12 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 15 Nov 2021 14:15:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=YBs/rPRHIsbvurPQTh13VoU7xJrY96WWrmngiU97r u8=; b=SmakmyqWzkCFwarKIC4XTWUePwM28IHLoCaFrezdDDwm+m/owTwFA6owl mFKcPbJRO0DaahS/VU05t78EKLOybVXQPMQbQs2AL7+o+HPvFekjNyZ17NWySE62 usKvJhgdC2WtQGrrBqRQUdJePoUfQ/cle9zGl98BnMQ7AR+ON1BO+TZcLKmKnPjo CPfPVBXir0D0WeUTpcNyIRZXKbe7yKixFmwAjIbiXCpMAQIpRDtFPoOTvtgCVpDn WwytcV/3s8pE53NIZw2lCFfyT3U874awGk6lfsKNedtdNEz3aUmLLP70B/ZXmB1F e1iSm8GIojSTEwGLgv6/220PosMZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrfedtgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvghtvghr ucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnthgvrh hprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeefjeegheetuefhveevudel ueeftdejteeiffetvdduhfdtieefgfeutedtveeggfenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthes vghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Nov 2021 14:15:10 -0500 (EST) Message-ID: <632f02ed-12ac-b91f-0e99-9c1b086f8cd0@enterprisedb.com> Date: Mon, 15 Nov 2021 20:15:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: Frontend error logging style Content-Language: en-US To: Robert Haas , Tom Lane Cc: PostgreSQL Hackers References: <1363732.1636496441@sss.pgh.pa.us> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10.11.21 16:28, Robert Haas wrote: > What I think we ought > to be driving towards is having pg_log_fatal() forcibly exit, and > pg_log_error() do the same unless the error is somehow caught. This is specifically designed not to do any flow control. In the backend, we have many instances, where log messages are issued with the wrong log level because the stronger log level would have flow control impact that is not appropriate at the call site. I don't think we want more of that, especially since the flow control requirements in the varied suite of frontend programs is quite diverse. Moreover, we also require control over the exit codes in some cases, which this kind of API wouldn't allow. Several programs wrap, say, pg_log_fatal() into a pg_fatal(), that does logging, cleanup, and exit, as the case may be. I think that's a good solution. If someone wanted to write a more widely reusable pg_fatal(), why not, but in my previous attempts, this was quite complicated and didn't turn out to be useful.