log_min_messages per backend type

Euler Taveira <euler@eulerto.com>

From: "Euler Taveira" <euler@eulerto.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2024-12-17T19:14:29Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Allow log_min_messages to be set per process type

  2. Assign "backend" type earlier during process start-up

  3. Use integer backend type when exec'ing a postmaster child

  4. Sort guc_parameters.dat alphabetically by name

  5. Create a separate file listing backend types

Attachments

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/