public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Robert Haas <[email protected]>
To: Tom Lane <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Frontend error logging style
Date: Mon, 15 Nov 2021 20:15:04 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+TgmoZjmJF0bTfd_q7yXWCR9cp0n6XgBHM7XPPy7R9jSWrJCQ@mail.gmail.com>
References: <[email protected]>
	<CA+TgmoZjmJF0bTfd_q7yXWCR9cp0n6XgBHM7XPPy7R9jSWrJCQ@mail.gmail.com>

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.






view thread (30+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Frontend error logging style
  In-Reply-To: <[email protected]>

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

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