Re: [HACKERS] WIP: Separate log file for extension - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: [HACKERS] WIP: Separate log file for extension
Date
Msg-id CABUevEw4-a-0T8Hka7Z-3WYCY+2-Sh0HY4TX_m=Qqk_xKRH2Cw@mail.gmail.com
Whole thread Raw
In response to [HACKERS] WIP: Separate log file for extension  (Antonin Houska <ah@cybertec.at>)
Responses Re: [HACKERS] WIP: Separate log file for extension  (Antonin Houska <ah@cybertec.at>)
List pgsql-hackers
On Fri, Aug 25, 2017 at 12:12 AM, Antonin Houska <ah@cybertec.at> wrote:
Attached is a draft patch to allow extension to write log messages to a
separate file. It introduces a concept of a "log stream". The extension's
shared library gets its stream assigned by calling this function from
_PG_init()

        my_stream_id = get_log_stream("my_extension", &my_log_stream);

I like this idea in general.

 
Then it's supposed to change some of its attributes

        adjust_log_stream_attr(&stream->filename, "my_extension.log");

This, however, seems to be wrong.

The logfile name does not belong in the extension, it belongs in the configuration file. I think the extension should set it's "stream id" or whatever you want to call it, and then it should be possible to control in postgresql.conf where that log is sent.

Also, what if this extension is loaded on demand in a session and not via shared_preload_libraries? It looks like the syslogger only gets the list of configured streams when it starts?

In short, I think the solution should be more generic, and not "just for extensions".

I completely missed this thread when I did my quick-wip at https://www.postgresql.org/message-id/flat/CABUevExztL0GORyWM9S4tR_Ft3FmJbRaxQdxj+BQZjpvmRurdw@mail.gmail.com#CABUevExztL0GORyWM9S4tR_Ft3FmJbRaxQdxj+BQZjpvmRurdw@mail.gmail.com  -- some of the changes made were close enough that I got the two confused :) Based on the feedback of that one, have you done any performance checks?


--

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] pgbench more operators & functions
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Setting pd_lower in GIN metapage