Re: [Proposal] Adding Log File Capability to pg_createsubscriber - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [Proposal] Adding Log File Capability to pg_createsubscriber
Date
Msg-id 78ae6b84-ad9d-4820-8b09-a37d18d05a1c@eisentraut.org
Whole thread Raw
In response to Re: [Proposal] Adding Log File Capability to pg_createsubscriber  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On 01.04.26 06:56, Amit Kapila wrote:
> 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
everythingthat 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.

In the proposed API, you can switch the log file at any time.  And there 
could be a separate log level for file output versus terminal output.

>>   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.

I think using MAXPGPATH is kind of deprecated and useless, certainly in 
new code.  But apart from that, note that in pg_createsubscriber.c 
itself, subscriber_dir is dynamically allocated.




pgsql-hackers by date:

Previous
From: Daniil Davydov
Date:
Subject: Re: POC: Parallel processing of indexes in autovacuum
Next
From: Peter Eisentraut
Date:
Subject: Re: [Proposal] Adding Log File Capability to pg_createsubscriber