Re: log_min_messages per backend type

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: japin <japinli(at)hotmail(dot)com>, "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: "Andres Freund" <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: log_min_messages per backend type
Date: 2025-10-05 14:18:53
Message-ID: 24b9bfd6-7fba-4946-9b73-244934b89464@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 31, 2025, at 8:34 PM, Japin Li wrote:
> On Thu, 31 Jul 2025 at 18:51, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>> On 2025-Aug-01, Japin Li wrote:
>>
>>> If we set the log level for all backend types, I don't think a generic log
>>> level is necessary.
>>
>> I don't understand what you mean by this. Can you elaborate?
>>
> For example:
>
> ALTER SYSTEM SET log_min_messages TO
> 'archiver:info, autovacuum:info, backend:info, bgworker:info,
> bgwriter:info, checkpointer:info, ioworker:info, logger:info,
> slotsyncworker:info, startup:info, walreceiver:info, walsender:info,
> walsummarizer:info, walwriter:info';
>
> Given that we've set a log level for every backend type and
> assigned[BACKEND_NUM_TYPES] is true, a generic level seems redundant.
>

The main reason I didn't consider this idea was that this GUC assignment will
fail as soon as a new backend type is added. Restore a dump should work
across major versions.

> I think we can avoid memory allocation by using pg_strncasecmp().
>

loglevel does not required a memory allocation but I didn't include the btype
part because it complicates the error message that uses btype a few lines
above.

This new patch contains the following changes:

- patch was rebased
- use commit dbf8cfb4f02
- use some GUC memory allocation functions
- avoid one memory allocation (suggested by Japin Li)
- rename backend type: logger -> syslogger
- adjust tests to increase test coverage
- improve documentation and comments to reflect the current state

--
Euler Taveira
EDB https://www.enterprisedb.com/

Attachment Content-Type Size
v4-0001-log_min_messages-per-backend-type.patch text/x-patch 26.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-10-05 15:59:17 Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Previous Message Ranier Vilela 2025-10-05 13:23:58 Fix misuse use of window_gettupleslot function (src/backend/executor/nodeWindowAgg.c)