Re: log_error_verbosity and unexpected errors

From: Oskari Saarenmaa <os(at)ohmu(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <stark(at)mit(dot)edu>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: log_error_verbosity and unexpected errors
Date: 2014-07-04 12:56:36
Message-ID: 53B6A484.9010605@ohmu.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02/07/14 22:10, Tom Lane wrote:
> Greg Stark <stark(at)mit(dot)edu> writes:
>> I think log_error_verbosity is a strange variable. It's useless for
>> expected user-facing errors but essential for unexpected errors that
>> indicate bugs in the code -- and you can only have it on for
>> everything or off for everything.
>
>> I'm finding I usually want it set to 'verbose' for anything that
>> PANICs or is generated by an elog() but it's just noise for anything
>> generated by an ereport() and is ERROR or below.

[...]

> [ thinks for a bit... ] A slightly cleaner approach is to nominate
> a specified set of SQLSTATEs, certainly including XX000 and perhaps
> some others, as being ones that force verbose reporting. That would
> have the same practical effect as far as elogs go, but wouldn't break
> the nominal functional equivalence.
>
> And that brings up the previous work on SQLSTATE-dependent choices
> about whether to log at all. I remember a patch was submitted for
> that but don't remember offhand why it didn't get committed. ISTM
> we should think about reviving that and making the choice be not just
> "log or not", but "no log, terse log, normal log, verbose log".

I had a patch for making log_min_error_statement configurable per
SQLSTATE in https://commitfest.postgresql.org/action/patch_view?id=1360
but you pointed out various issues in it and I didn't have time to
update it for 9.4. I'm going to rewrite it based on the comments and
submit it again for a 9.5 commitfest.

The same mechanism could be used to set verbosity per SQLSTATE.

/ Oskari

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2014-07-04 13:29:07 Re: pg_xlogdump --stats
Previous Message furuyao 2014-07-04 10:45:20 Re: pg_receivexlog add synchronous mode