pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Frontend error logging style
Date: Mon, 23 May 2022 11:53:04 +0200
Message-ID: <ba6d4fac-9e33-91f9-94fb-1e4c144a48b9@enterprisedb.com> (raw)
In-Reply-To: <6acbce27-3472-fc58-538b-ba6770ed0bfa@enterprisedb.com>
References: <YZMfMI3kTDw/RU0k@paquier.xyz>
	<CA+TgmoZy84orCfUNipEp+QzWwRuR2yrjsdcJN9ROHzPkXDRbxQ@mail.gmail.com>
	<a06f311b-18cd-ee56-ad4c-03ed0f93713f@enterprisedb.com>
	<CA+TgmoYaA1wtU91yNg1_C6oS8azAfp5dQ1YrfuNAm2=Yefrn1A@mail.gmail.com>
	<913687.1645572199@sss.pgh.pa.us>
	<6fdb3ab3-f093-27b9-dfdc-c391e69163fc@enterprisedb.com>
	<1346360.1645715441@sss.pgh.pa.us>
	<1895619.1645809325@sss.pgh.pa.us>
	<20220322015135.k4tcd3tsjq5xydqa@alap3.anarazel.de>
	<2446238.1647914437@sss.pgh.pa.us>
	<20220322021348.pvtvgrseyfohkxob@alap3.anarazel.de>
	<471299.1648412393@sss.pgh.pa.us>
	<6acbce27-3472-fc58-538b-ba6770ed0bfa@enterprisedb.com>

On 29.03.22 16:24, Peter Eisentraut wrote:
> I think I would want the program name/location also in front of the 
> detail and hint lines.  I need to think about this a bit more.  This 
> shouldn't hold up this patch; it would be a quick localized change.

After experiencing this for a bit now, I propose to make this change.
It lines up better and allows easier filtering of messages by program.

Example:

Before:

initdb: error: locale "zh_HK.Big5HKSCS" requires unsupported encoding "BIG5"
detail: Encoding "BIG5" is not allowed as a server-side encoding.
hint: Rerun initdb with a different locale selection.

After:

initdb: error: locale "zh_HK.Big5HKSCS" requires unsupported encoding "BIG5"
initdb: detail: Encoding "BIG5" is not allowed as a server-side encoding.
initdb: hint: Rerun initdb with a different locale selection.

Attachments:

0001-logging-Also-add-the-command-prefix-to-detail-and-hi.patch (text/plain, 1.5K) download From 565fe56ebf9449cd9143424ef1b8083d99019d75 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> Date: Mon, 23 May 2022 11:44:32 +0200 Subject: [PATCH] logging: Also add the command prefix to detail and hint messages This makes the output line up better and allows filtering messages by command. --- src/bin/pg_dump/t/003_pg_dump_with_server.pl | 2 +- src/common/logging.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bin/pg_dump/t/003_pg_dump_with_server.pl b/src/bin/pg_dump/t/003_pg_dump_with_server.pl index a0b23aae0f..8cc9da0659 100644 --- a/src/bin/pg_dump/t/003_pg_dump_with_server.pl +++ b/src/bin/pg_dump/t/003_pg_dump_with_server.pl @@ -30,7 +30,7 @@ command_fails_like( [ "pg_dump", '-p', $port, '--include-foreign-data=s0', 'postgres' ], - qr/foreign-data wrapper \"dummy\" has no handler\r?\ndetail: Query was: .*t0/, + qr/foreign-data wrapper \"dummy\" has no handler\r?\npg_dump: detail: Query was: .*t0/, "correctly fails to dump a foreign table from a dummy FDW"); command_ok( diff --git a/src/common/logging.c b/src/common/logging.c index 0b5bcb1a17..64604c5209 100644 --- a/src/common/logging.c +++ b/src/common/logging.c @@ -246,8 +246,7 @@ pg_log_generic_v(enum pg_log_level level, enum pg_log_part part, fmt = _(fmt); - if (part == PG_LOG_PRIMARY && - (!(log_flags & PG_LOG_FLAG_TERSE) || filename)) + if (!(log_flags & PG_LOG_FLAG_TERSE) || filename) { if (sgr_locus) fprintf(stderr, ANSI_ESCAPE_FMT, sgr_locus); -- 2.36.1

view thread (51+ messages)  latest in thread

Message-ID: <ba6d4fac-9e33-91f9-94fb-1e4c144a48b9@enterprisedb.com>
Permalink:  ../ba6d4fac-9e33-91f9-94fb-1e4c144a48b9@enterprisedb.com/
Also on:    postgresql.org/message-id/ba6d4fac-9e33-91f9-94fb-1e4c144a48b9@enterprisedb.com

 ·  · 

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: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: Frontend error logging style
  In-Reply-To: <ba6d4fac-9e33-91f9-94fb-1e4c144a48b9@enterprisedb.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