From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Unified logging system for command-line programs |
Date: | 2019-01-03 21:01:14 |
Message-ID: | 6174.1546549274@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> On 03/01/2019 19:03, Andres Freund wrote:
>>> Relatedly, rewriting all the frontend programs to exception style would
>>> end up being a 10x project to rewrite everything for no particular
>>> benefit. Going from 8 or so APIs to 2 is already an improvement, I
>>> think. If someone wants to try going further, it can be considered, but
>>> it would be an entirely different project.
>> Why would it be 10x the effort,
> Because you would have to rewrite all the programs to handle elog(ERROR)
> jumping somewhere else.
FWIW, this argument has nothing to do with what I was actually
proposing. I envisioned that we'd have a wrapper in which
non-error ereports() map directly onto what you're calling
pg_log_debug, pg_log_warning, etc, while ereport(ERROR) has the
effect of writing a message and then calling exit(1). We would
use ereport(ERROR) in exactly the places where we're now writing
a message and calling exit(1). No change at all in program
flow control, but an opportunity to consolidate code in places
that are currently doing this sort of thing:
#ifndef FRONTEND
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not open file \"%s\" for reading: %m",
ControlFilePath)));
#else
{
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
progname, ControlFilePath, strerror(errno));
exit(EXIT_FAILURE);
}
#endif
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2019-01-03 21:08:25 | Re: pgsql: Update ssl test certificates and keys |
Previous Message | PG Bug reporting form | 2019-01-03 20:27:33 | BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name |