Hi,

When debugging lwlock issues I found PRINT_LWDEBUG/LOG_LWDEBUG rather
painful to use because of the amount of elog contexts/statements
emitted. Given the number of lwlock acquirations that's just not doable.

To solve that during development I've solved that by basically
replacing:
    if (Trace_lwlocks)
           elog(LOG, "%s(%s %d): %s", where, name, index, msg);

with something like

    if (Trace_lwlocks)
    {
        ErrorContextCallback *old_error_context_stack;
...
        old_error_context_stack = error_context_stack;
        error_context_stack = NULL;
        ereport(LOG,
               (errhidestmt(true),
                errmsg("%s(%s %d): %s", where, T_NAME(lock),
T_ID(lock), msg)));

I think it'd generally be useful to have something like errhidecontext()
akin to errhidestatement() to avoid things like the above.

The usecases wher eI see this as being useful is high volume debug
logging, not normal messages...

Greetings,

Andres Freund

--
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to