Re: pgbench - use pg logging capabilities

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench - use pg logging capabilities
Date: 2020-01-03 10:55:20
Message-ID: 4763a276-149c-927c-f8d1-7a53a9610bd3@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-01-01 22:55, Fabien COELHO wrote:
> I'm trying to keep the column width under control, but if you like it
> wider, here it is.
>
> Compared to v1 I have also made a few changes to be more consistent when
> using fatal/error/info.

The renaming of debug to debug_level seems unnecessary and unrelated.

In runShellCommand(), you removed some but not all argv[0] from the
output messages. I'm not sure what the intent was there.

I would also recommend these changes:

- pg_log_fatal("query failed: %s", sql);
- pg_log_error("%s", PQerrorMessage(con));
+ pg_log_fatal("query failed: %s", PQerrorMessage(con));
+ pg_log_info("query was: %s", sql);

This puts the most important information first.

- pg_log_error("connection to database \"%s\" failed", dbName);
- pg_log_error("%s", PQerrorMessage(conn));
+ pg_log_error("connection to database \"%s\" failed: %s",
+ dbName, PQerrorMessage(conn));

Line break here is unnecessary.

In both cases, pg_dump has similar messages that can serve as reference.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Surafel Temesgen 2020-01-03 10:57:15 Re: WIP: System Versioned Temporal Table
Previous Message Peter Eisentraut 2020-01-03 10:51:15 Re: pgbench - allow to create partitioned tables