pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Log the location field before any backtrace
5+ messages / 4 participants
[nested] [flat]

Commits from this thread:
  2020-07-10 8ff4d1277b ff61359ad7  Log the location field before any backtrace
* Log the location field before any backtrace
@ 2020-07-09 09:17  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2020-07-09 09:17 UTC (permalink / raw)
  To: pgsql-hackers

In PG13, we added the ability to add backtraces to the log output. 
After some practical experience with it, I think the order in which the 
BACKTRACE and the LOCATION fields are printed is wrong.  I propose we 
put the LOCATION field before the BACKTRACE field, not after.  This 
makes more sense because the location is effectively at the lowest level 
of the backtrace.

Patch attached.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-Log-the-location-field-before-any-backtrace.patch (text/plain, 1.4K) download From aaf4a8146cf60a5959e50432359fd9972f410e1b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> Date: Thu, 9 Jul 2020 11:00:34 +0200 Subject: [PATCH] Log the location field before any backtrace This order makes more sense because the location is effectively at the lowest level of the backtrace. --- src/backend/utils/error/elog.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index e976201030..e4b717c79a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -2938,13 +2938,6 @@ send_message_to_server_log(ErrorData *edata) append_with_tabs(&buf, edata->context); appendStringInfoChar(&buf, '\n'); } - if (edata->backtrace) - { - log_line_prefix(&buf, edata); - appendStringInfoString(&buf, _("BACKTRACE: ")); - append_with_tabs(&buf, edata->backtrace); - appendStringInfoChar(&buf, '\n'); - } if (Log_error_verbosity >= PGERROR_VERBOSE) { /* assume no newlines in funcname or filename... */ @@ -2962,6 +2955,13 @@ send_message_to_server_log(ErrorData *edata) edata->filename, edata->lineno); } } + if (edata->backtrace) + { + log_line_prefix(&buf, edata); + appendStringInfoString(&buf, _("BACKTRACE: ")); + append_with_tabs(&buf, edata->backtrace); + appendStringInfoChar(&buf, '\n'); + } } /* -- 2.27.0
^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: Log the location field before any backtrace
@ 2020-07-09 11:25  Daniel Gustafsson <daniel@yesql.se>
  parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Daniel Gustafsson @ 2020-07-09 11:25 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers

> On 9 Jul 2020, at 11:17, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
> 
> In PG13, we added the ability to add backtraces to the log output. After some practical experience with it, I think the order in which the BACKTRACE and the LOCATION fields are printed is wrong.  I propose we put the LOCATION field before the BACKTRACE field, not after.  This makes more sense because the location is effectively at the lowest level of the backtrace.

Makes sense, +1

cheers ./daniel




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Log the location field before any backtrace
@ 2020-07-09 16:31  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 5+ messages in thread

From: Alvaro Herrera @ 2020-07-09 16:31 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On 2020-Jul-09, Daniel Gustafsson wrote:

> > On 9 Jul 2020, at 11:17, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
> > 
> > In PG13, we added the ability to add backtraces to the log output. After some practical experience with it, I think the order in which the BACKTRACE and the LOCATION fields are printed is wrong.  I propose we put the LOCATION field before the BACKTRACE field, not after.  This makes more sense because the location is effectively at the lowest level of the backtrace.
> 
> Makes sense, +1

Likewise

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Log the location field before any backtrace
@ 2020-07-10 02:04  Michael Paquier <michael@paquier.xyz>
  parent: Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Michael Paquier @ 2020-07-10 02:04 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Daniel Gustafsson <daniel@yesql.se>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; pgsql-hackers

On Thu, Jul 09, 2020 at 12:31:38PM -0400, Alvaro Herrera wrote:
> On 2020-Jul-09, Daniel Gustafsson wrote:
>> On 9 Jul 2020, at 11:17, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
>>> 
>>> In PG13, we added the ability to add backtraces to the log
>>> output. After some practical experience with it, I think the
>>> order in which the BACKTRACE and the LOCATION fields are printed
>>> is wrong.  I propose we put the LOCATION field before the
>>> BACKTRACE field, not after.  This makes more sense because the
>>> location is effectively at the lowest level of the backtrace. 
>> 
>> Makes sense, +1
> 
> Likewise

+1.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Log the location field before any backtrace
@ 2020-07-10 06:36  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 5+ messages in thread

From: Peter Eisentraut @ 2020-07-10 06:36 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Daniel Gustafsson <daniel@yesql.se>; pgsql-hackers

On 2020-07-10 04:04, Michael Paquier wrote:
> On Thu, Jul 09, 2020 at 12:31:38PM -0400, Alvaro Herrera wrote:
>> On 2020-Jul-09, Daniel Gustafsson wrote:
>>> On 9 Jul 2020, at 11:17, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
>>>>
>>>> In PG13, we added the ability to add backtraces to the log
>>>> output. After some practical experience with it, I think the
>>>> order in which the BACKTRACE and the LOCATION fields are printed
>>>> is wrong.  I propose we put the LOCATION field before the
>>>> BACKTRACE field, not after.  This makes more sense because the
>>>> location is effectively at the lowest level of the backtrace.
>>>
>>> Makes sense, +1
>>
>> Likewise
> 
> +1.

committed

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2020-07-10 06:36 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 09:17 Log the location field before any backtrace Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2020-07-09 11:25 ` Daniel Gustafsson <daniel@yesql.se>
2020-07-09 16:31   ` Alvaro Herrera <alvherre@2ndquadrant.com>
2020-07-10 02:04     ` Michael Paquier <michael@paquier.xyz>
2020-07-10 06:36       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

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