Re: Set log_line_prefix and application name in test drivers - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: Set log_line_prefix and application name in test drivers
Date
Msg-id alpine.DEB.2.20.1608261620260.7102@lancre
Whole thread Raw
In response to Re: Set log_line_prefix and application name in test drivers  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: Set log_line_prefix and application name in test drivers  (Christoph Berg <myon@debian.org>)
List 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
attributea 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



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: WAL consistency check facility
Next
From: Fujii Masao
Date:
Subject: Re: GIN logging GIN_SEGMENT_UNMODIFIED actions?