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

From: Craig Ringer <craig(dot)ringer(at)2ndquadrant(dot)com>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Override compile time log levels of specific messages/modules
Date: 2016-09-06 09:36:53
Message-ID: CAMsr+YE9xtBQkLhsvBjz4oj0Zv5TZT2LkER6+-EjnQJec31Rjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 6 Sep. 2016 17:28, "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com> wrote:
>

>
> The patch uses some preprocessing and scripting magic to assign distinct
identifiers to each module (a subdir in the source code), to each file and
to each elog message. It then provides a set of functions by which an user
can increase/decrease/set log levels for either individual messages or all
messages within a source file or source module. The log levels can be
changed only for specific backends or all current or future backends. If
you configure with --enable-genmsgids switch, a MSGMODULES and MSGIDS file
is created in $srcdir, which can later be used to know ids assigned to
various modules/messages.

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.

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.)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2016-09-06 09:49:20 Re: Logical Replication WIP
Previous Message Pavan Deolasee 2016-09-06 09:26:24 Override compile time log levels of specific messages/modules