Thread: 9.2 Reviewfest - logging hooks patch

9.2 Reviewfest - logging hooks patch

From
Christopher Maujean
Date:
Patch
<http://archives.postgresql.org/message-id/4EDBEFBB.9070509@gmail.com>


In reviewing the referenced patch, we found that it has no developer
documentation and no regression tests. While it compiles and installs,
there is nothing to tell us how to use (or test) it.


--Christopher

________________________________

Please consider the environment before printing this email.

The information contained in this email may be confidential and/or legally privileged. It has been sent for the sole
useof the intended recipient(s). If the reader of this message is not an intended recipient, you are hereby notified
thatany unauthorized review, use, disclosure, dissemination, distribution, or copying of this communication, or any of
itscontents, is strictly prohibited. If you have received this communication in error, please reply to the sender and
destroyall copies of the message. Finally, the recipient should check this email and any attachments for the presence
ofviruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 



Re: 9.2 Reviewfest - logging hooks patch

From
Martin Pihlak
Date:
On 01/13/2012 05:29 AM, Christopher Maujean wrote:
> Patch
> <http://archives.postgresql.org/message-id/4EDBEFBB.9070509@gmail.com>
> 
> 
> In reviewing the referenced patch, we found that it has no developer
> documentation and no regression tests. While it compiles and installs,
> there is nothing to tell us how to use (or test) it.
> 

Thanks for reviewing!

I think the regression tests should be part of the module that uses
the hooks. Alas, there are none that we'd want to ship with Postgres
at this time.

The best I could offer for testing the hooks is a log forwarding module
I've been working on. Basically, what it does is that it installs the
hooks, looks at the message emitted by backend and if needed sends it
away via UDP. Available at: https://github.com/mpihlak/pg_logforward

To install, run "make install" and modify postgresql.conf to include:

shared_preload_libraries = 'pg_logforward'
logforward.target_names = 'jsonsrv'
logforward.jsonsrv_host = '127.0.0.1'
logforward.jsonsrv_port = 23456

Now, after restarting postgres, you could use "nc 23456 -u -l" to
receive the log. Alternatively use testing/test_logserver.py as a
log "server".

About documentation - it sure would be nice to have all the hooks
written up somewhere. Any suggestions as to where to put it?

regards,
Martin