log_min_messages per backend type

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: log_min_messages per backend type
Date: 2024-12-17 19:14:29
Message-ID: e85c6671-1600-4112-8887-f97a8a5d07b2@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Sometimes you need to inspect some debug messages from autovacuum worker but
you cannot apply the same setting for backends (that could rapidly fill the log
file). This proposal aims to change log_min_messages to have different log
levels depending on which backend type the message comes from.

The syntax was changed from enum to string and it accepts a list of elements.

Instead of enum, it now accepts a comma-separated list of elements (string).
Each element is LOGLEVEL:BACKENDTYPE. It still accepts the old syntax (single
log level for backward compatibility. In this case, it sets all backend types
to the informed log level. For the list, the default log level (WARNING) is
used for the backend types that are not specified.

SET log_min_messages TO 'debug2:checkpointer, debug1:autovacuum';
SHOW log_min_messages;
log_min_messages
----------------------------------------
debug2:checkpointer, debug1:autovacuum
(1 row)

In the above example, it sets log level DEBUG2 to checkpointer process and
DEBUG1 to autovacuum launcher and autovacuum worker processes. The other
processes keep WARNING (default) as log level.

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

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-12-17 19:25:01 Re: Adding NetBSD and OpenBSD to Postgres CI
Previous Message Andres Freund 2024-12-17 18:59:14 Re: Adding NetBSD and OpenBSD to Postgres CI