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: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Gyan Sreejith <gyan.sreejith@gmail.com>, Peter Smith <smithpb2250@gmail.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-08T05:30:58Z
Lists: pgsql-hackers
On Tue, Apr 7, 2026 at 7:07 PM Peter Eisentraut <peter@eisentraut.org> wrote:
>
> On 01.04.26 07:05, Hayato Kuroda (Fujitsu) wrote:
> > Dear Peter E.,
> >
> >> Instead of creating a new logging API in pg_createsubscriber locally,
> >> why not extend logging.c to support a log file.
> >
> > I had a concern to extend the common module. Do you have possible idea to use
> > pg_logging_set_logfile() on others? I cannot, tee command on linux seems enough
> > for others.
>
> pg_upgrade was mentioned.
>

I see that pg_upgrade has some specific requirements related to
verbose/status/report kind of messages which doesn't seem to be
directly handled by the generic API  pg_log_generic(). For example,
apart from other things, we need to unset/reset log_file when we want
to send messages only to the terminal and quite some specific handling
for status or other kinds of messages. If you think pg_log_generic
could be extended to handle various upgrade cases then I think it
would be a good use case for it and we should go-ahead with what you
are proposing. OTOH, maybe we can give it a separate try and use the
resulting API for both pg_createsubscriber and pg_upgrade. I am fine
either way you would like to go-ahead with this.

-- 
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 →
  1. pg_createsubscriber: Don't use MAXPGPATH

  2. pg_createsubscriber: Remove separate logfile_open() function

  3. pg_createsubscriber: Use logging.c log file callback

  4. Add log file support to logging.c

  5. pg_createsubscriber: Add -l/--logdir option to redirect output to files.

  6. pg_createsubscriber: Introduce module-specific logging functions.

  7. Fix another buglet in archive_waldump.c.