Re: [Proposal] Adding Log File Capability to pg_createsubscriber
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Gyan Sreejith <gyan.sreejith@gmail.com>,
Peter Smith <smithpb2250@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
shveta malik <shveta.malik@gmail.com>, Shlok Kyal <shlok.kyal.oss@gmail.com>, vignesh C <vignesh21@gmail.com>, Euler Taveira <euler@eulerto.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-01T04:56:53Z
Lists: pgsql-hackers
On Tue, Mar 31, 2026 at 5:36 PM Peter Eisentraut <peter@eisentraut.org> wrote: > > On 25.03.26 09:25, Amit Kapila wrote: > > On Wed, Mar 25, 2026 at 5:43 AM Gyan Sreejith <gyan.sreejith@gmail.com> wrote: > >> > >> Thank you, Kuroda-san and Chao for the suggestions and the patch. I have merged it with v18-0001, and I have fixed everything that Peter suggested. > >> > > > > Pushed after minor changes. > > Instead of creating a new logging API in pg_createsubscriber locally, > why not extend logging.c to support a log file. > Few things we may want to consider if we want to use extended logging.c: (a) what if we want information to be written in multiple files (say pub/sub specific info into separate files), something like what pg_upgrade does, (b) what if we want to write some info to only one of terminal or log_file, we can probably extend generic API for this. > This is much simpler, > doesn't require caller changes, and could be reused elsewhere. See > attached patches. (The 0003 and 0004 are just some additional code > simplifications.) > In 0004, -static char logdir[MAXPGPATH]; /* Subdirectory of the user specified logdir +static char *logdir = NULL; /* Subdirectory of the user specified logdir At other places like pg_upgrade, we use MAXPGPATH for a similar case probably to have standard length on all platforms, see make_outputdirs() in pg_upgrade.c. -- With Regards, Amit Kapila.
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pg_createsubscriber: Don't use MAXPGPATH
- 99b726ac4894 19 (unreleased) landed
-
pg_createsubscriber: Remove separate logfile_open() function
- f5528b90b411 19 (unreleased) landed
-
pg_createsubscriber: Use logging.c log file callback
- 847336ba53af 19 (unreleased) landed
-
Add log file support to logging.c
- 41237556f8c5 19 (unreleased) landed
-
pg_createsubscriber: Add -l/--logdir option to redirect output to files.
- 6b5b7eae3ae6 19 (unreleased) landed
-
pg_createsubscriber: Introduce module-specific logging functions.
- d6628a5ea0a5 19 (unreleased) landed
-
Fix another buglet in archive_waldump.c.
- 69c57466a752 19 (unreleased) cited