Suppressing elog.c context messages (was Re: Wait free LW_SHARED acquisition)
| От | Andres Freund |
|---|---|
| Тема | Suppressing elog.c context messages (was Re: Wait free LW_SHARED acquisition) |
| Дата | |
| Msg-id | 20141219160604.GG5023@alap3.anarazel.de обсуждение исходный текст |
| Ответы |
Re: Suppressing elog.c context messages (was Re: Wait free
LW_SHARED acquisition)
|
| Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: