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()
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".