Re: [Proposal] Adding Log File Capability to pg_createsubscriber

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Gyan Sreejith <gyan(dot)sreejith(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, vignesh C <vignesh21(at)gmail(dot)com>
Subject: Re: [Proposal] Adding Log File Capability to pg_createsubscriber
Date: 2026-01-12 08:52:24
Message-ID: CAA4eK1JCNfdBNTbR5jWKhMkoUaYKNhZegBT6nc2Tehck2JKxBg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 10, 2025 at 3:47 AM Gyan Sreejith <gyan(dot)sreejith(at)gmail(dot)com> wrote:
>
> pg_createsubscriber currently outputs all messages (internal validation messages, standby server start/stop logs, recovery progress output, and output from utilities) directly to the console. As a result, users may find debugging and handling errors difficult. It would be more convenient if messages were separated and stored in different log files. There is already a similar implementation in pg_upgrade.
>
> Proposed Solution:
>
> Based on issues mentioned previously, I would like to propose a new argument -l <logdir> which can be specified for pg_createsubscriber. Using it would create the following log files:
>
> logdir/pg_createsubscriber_server.log which captures all logs related to starting and stopping the standby server.
>
> logdir/pg_createsubscriber_resetwal.log which captures the output of pg_resetwal
>
> logdir/pg_createsubscriber_internal.log which captures internal diagnostic output from pg_createsubscriber (validations, checks, etc.)
>

I think we don't need pg_createsubscriber_resetwal.log separately as
it just prints "Write-ahead log reset", it could as well be part of
pg_createsubscriber_server.log. Also, I noticed that even when -l
option is used, the additional LOG in verbose mode still goes to
console which is difficult to parse. I fell that should also be part
of .log files created by this patch.

Additionally, I think it is better to use a folder with time to store
as LOG files as used in pg_upgrade. This helps to distinguish log
files for different runs (say in case of failures).

I also thought to further split pg_createsubscriber_internal.log into
publisher and subscriber specific LOGs but not sure if that is worth,
so we can leave that for now.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-01-12 09:02:19 ALTER TABLE: warn when actions do not recurse to partitions
Previous Message Kirill Reshke 2026-01-12 08:51:10 Re: Use correct macro for accessing offset numbers.