From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Log the location field before any backtrace
Date: Thu, 9 Jul 2020 11:17:32 +0200
Message-ID: <90f5fa04-c410-a54e-9449-aa3749fb7972@2ndquadrant.com> (raw)
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.cindex 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
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: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com
Subject: Re: Log the location field before any backtrace
In-Reply-To: <90f5fa04-c410-a54e-9449-aa3749fb7972@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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