Masahiko Sawada <sawada.m...@gmail.com> wrote: > On Fri, Aug 25, 2017 at 4:12 PM, Antonin Houska <a...@cybertec.at> wrote: > > Attached is a draft patch to allow extension to write log messages to a > > separate file. > > Does it allow postgres core code to write log messages to multiple log > files as well? I can imagine a use case where we want to write log > messages to separate log files by error level or purpose (server log > and SQL log etc).
At low level it should work as long as several log streams are reserved for the core code. However, as every single stream needs multiple variables, I have no idea how to configure those additional streams w/o adding many new GUC variables to the core. Also the discussion what should (not) be logged separate would probably be difficult. Specifically to log SQL statements to a separate file, I think (but not verified) that you can write an extension that reserves a stream for itself and also uses emit_log_hook to recognize SQL statements among the logged messages. If the hook adjusts the syslogger_stream field of ErrorData accordingly, the message should end up in the separate file. -- 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 (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers