Re: Patch to implement pg_current_logfile() function - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Patch to implement pg_current_logfile() function
Date
Msg-id CA+TgmoZqpzE-qv5za2dxF=1b+RLX=X14DbMso59ZVimHFehwzQ@mail.gmail.com
Whole thread Raw
In response to Patch to implement pg_current_logfile() function  (Gilles Darold <gilles.darold@dalibo.com>)
Responses Re: Patch to implement pg_current_logfile() function
List pgsql-hackers
On Wed, Mar 9, 2016 at 12:32 PM, Gilles Darold <gilles.darold@dalibo.com> wrote:
> I choose to allow the log collector to write his current log file name
> into the lock file 'postmaster.pid'. This allow simple access to this
> information through system commands, for example:
>
> postgres@W230ST:~$ tail -n1 /usr/local/pgql-devel/data/postmaster.pid
> pg_log/postgresql-2016-03-09_152908.log
>
> Log filename is written at the 8th line position when log collection
> is active and all other information have been written to lock file.
>
> The function pg_current_logfile() use in SQL mode read the lock file
> to report the information.
>
> I don't know if there's any limitation on using postmaster.pid file to
> do that but it seems to me a bit weird to log this information to an
> other file. My first attempt was to use a dedicated file and save it
> to global/pg_current_logfile or pg_stat_tmp/pg_current_logfile but I
> think it is better to use the postmaster.pid file for that.

Gosh, why?  Piggybacking this on a file written for a specific purpose
by a different process seems like making life very hard for yourself,
and almost certainly a recipe for bugs.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Floating point timestamps
Next
From: Tom Lane
Date:
Subject: Re: Small patch: fix warnings during compilation on FreeBSD