Re: Override compile time log levels of specific messages/modules

Поиск
Список
Период
Сортировка
От Pavan Deolasee
Тема Re: Override compile time log levels of specific messages/modules
Дата
Msg-id CABOikdMzM-7CH2Zp_UXfMf7eN-LvyEYwWUh==R9XUxuWk3-Y2g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Override compile time log levels of specific messages/modules  (Craig Ringer <craig.ringer@2ndquadrant.com>)
Список pgsql-hackers


On Tue, Sep 6, 2016 at 3:06 PM, Craig Ringer <craig.ringer@2ndquadrant.com> wrote:


I think it's worth looking at how Java handles logging. We can't achieve an exact parallel in C as we don't really have a class hierarchy ... but we do have subsystems roughly grouped by file and directory structure.

Sure. In some large, popular enterprise softwares I've worked with many years ago, we used to define modules within each source file and then manually assign distinct integer IDs to each message and then provide various utilities to turn on/off specific messages or range of messages within a module. 

Being able to promote/demote these or selective lower the log level threshold on a directory, file, function and line level would be exceedingly handy. Pretty much all of that can be magic'd up from macro output so hopefully no postprocessing should be needed. (Though only gcc has _FUNC_ or _FUNCTION_ I think so we'd have selective support there.)

Well, __FUNCTION__  expands to function name and lookup based on string identifiers will always be costly, especially if you want to sprinkle the code with lot many debug messages. Same with __FILE__. I believe we need an unique integer constant to make it a fast, O(1) lookup. I couldn't find any other method to do that when I wrote the facility and hence did what I did.

Thanks,
Pavan
--
 Pavan Deolasee                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: Logical Replication WIP
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: LOCK TABLE .. DEFERRABLE