Re: Set log_line_prefix and application name in test drivers

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Set log_line_prefix and application name in test drivers
Date: 2016-08-26 14:34:13
Message-ID: alpine.DEB.2.20.1608261620260.7102@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Peter,

> log_line_prefix = '%t [%p]: [%l] %qapp=%a '
>
> which is modeled after the pgfouine recommendation, which is I believe a
> wide-spread convention, and it also vaguely follows syslog customs.
>
> The build farm client has
>
> log_line_prefix = '%m [%c:%l] '
>
> which is very similar, but the lack of the PID makes it unsuitable for
> the purposes that I have set out, and there is no obvious place to put
> additional information such as %a.
>
> %m vs %t is obviously a minor issue that I will gladly adjust, but
> besides that I prefer to stick with my version.

v2 patch looks ok, applies without trouble and works as intended:

2016-08-26 09:19:31.191 CEST [7571]: [58] app=pg_regress/event_trigger STATEMENT: alter type rewritetype alter attribute a type varchar cascade;

About the format: '[\d+]' pattern is used twice, which makes the output
less easily grep-able.

Also, the ':' is used as a separator in the remainder of the message, so
maybe once is enough at this level.

I'm not sure about the "app=" is really necessary, given its very explicit
definition as can be seen above above.

So I would suggest something like the following, which is also a little
bit more compact:

log_line_prefix = '%m [%p:%l] %q%a '

If you want to keep something with %a, maybe parentheses?

Finally I'm wondering also whether a timestamp since the server has
started (which does not exists) would be more useful for a "make check",
or at default maybe %n?

--
Fabien

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2016-08-26 14:35:16 Re: GIN logging GIN_SEGMENT_UNMODIFIED actions?
Previous Message Alvaro Herrera 2016-08-26 14:24:25 Re: WAL consistency check facility