[HACKERS] WIP: Separate log file for extension
От
Antonin Houska
Тема
[HACKERS] WIP: Separate log file for extension
Дата
Msg-id
19581.1503645168@linux-at0a
Список
Дерево обсуждения
[HACKERS] WIP: Separate log file for extension Antonin Houska <ah@cybertec.at>
Re: [HACKERS] WIP: Separate log file for extension Magnus Hagander <magnus@hagander.net>
Re: [HACKERS] WIP: Separate log file for extension Antonin Houska <ah@cybertec.at>
Re: [HACKERS] WIP: Separate log file for extension Antonin Houska <ah@cybertec.at>
Re: [HACKERS] WIP: Separate log file for extension Tom Lane <tgl@sss.pgh.pa.us>
Re: Re: [HACKERS] WIP: Separate log file for extension David Steele <david@pgmasters.net>
Re: [HACKERS] WIP: Separate log file for extension Jing Wang <jingwangian@gmail.com>
Re: [HACKERS] WIP: Separate log file for extension Masahiko Sawada <sawada.mshk@gmail.com>
Re: [HACKERS] WIP: Separate log file for extension Antonin Houska <ah@cybertec.at>
Re: [HACKERS] WIP: Separate log file for extension Craig Ringer <craig@2ndquadrant.com>
Re: [HACKERS] WIP: Separate log file for extension Antonin Houska <ah@cybertec.at>
Re: [HACKERS] WIP: Separate log file for extension Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [HACKERS] WIP: Separate log file for extension Antonin Houska <ah@cybertec.at>
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);
Then it's supposed to change some of its attributes
adjust_log_stream_attr(&stream->filename, "my_extension.log");
and to use the stream id in ereport() calls
ereport(LOG, (errmsg("Hello world"), errstream(my_stream_id)));
The EXEC_BACKEND mechanism makes initialization of the log streams by
postmaster child processes non-trivial. I decided to extend
save_backend_variables() and restore_backend_variables() accordingly. Maybe
someone has better idea.
pgaudit seems to be the most obvious use case for this enhancement, but it
might be useful for many other extensions.
--
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de, http://www.cybertec.at
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
В списке pgsql-hackers по дате отправления
От: Masahiko Sawada
Дата: