error handling in logging hooks

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: error handling in logging hooks
Date: 2012-08-10 15:21:52
Message-ID: 1344612112.13818.6.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

What is the intended way to handle errors in the new logging hook? For
example, errors in establishing a connection to wherever a hook wants to
send things.

The reference implementation pg_logforward just uses fprintf(stderr) to
communicate its own errors, which doesn't seem ideal.

Calling elog(ERROR) in the logging hook causes death by recursion. It
seems that some of the recursion protection infrastructure of elog.c
isn't exposed to the public, so it's not obvious how to use it.

Should logging hooks handle this themselves (could be complicated,
multiple hooks etc.), or should we try to build this into elog.c where
the hooks are called?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2012-08-10 16:29:39 Re: bug of pg_trgm?
Previous Message Magnus Hagander 2012-08-10 12:57:55 Re: Bugs in superuser_reserved_connections and max_wal_senders vs max_connections