RE: libpq debug log

From: "Nagaura, Ryohei" <nagaura(dot)ryohei(at)jp(dot)fujitsu(dot)com>
To: "Iwata, Aya" <iwata(dot)aya(at)jp(dot)fujitsu(dot)com>, 'Jacob Champion' <pchampion(at)pivotal(dot)io>, 'Jim Doty' <jdoty(at)pivotal(dot)io>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, "nagata(at)sraoss(dot)co(dot)jp" <nagata(at)sraoss(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 'Haribabu Kommi' <kommi(dot)haribabu(at)gmail(dot)com>, 'Peter Eisentraut' <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Subject: RE: libpq debug log
Date: 2019-01-25 01:00:42
Message-ID: EDA4195584F5064680D8130B1CA91C453BF258@G01JPEXMBYT04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Iwata-san,

I used your patch for my private work, so I write my opinion and four feedback below.
On Fri, Jan 18, 2019 at 8:19 AM, Iwata, Aya wrote:
> - Setting whether to get log or not by using connection strings or environment
> variables. It means that application source code changes is not needed to get
> the log.
> - Getting time when receive and send process start/end. Functions too.
This merit was very helpful for my use, so I want your proposal function in postgres.

The followings are feedback from me.

It would be better making the log format the same as the server log format, I think.
Your log format:
2019/01/22 04:15:25.496 ...
Server log format:
2019-01-22 04:15:25.496 UTC ...
There are two differences:
One is separator character of date, "/" and "-".
The another is standard time information.

It was difficult for me to understand the first line message in the log file.
"Max log size is 10B, log min level is LEVEL1"
Does this mean as follows?
"The maximum size of this file is 10 Bytes, the parameter 'log min level' is set to LEVEL 1."

Under the circumstance that the environment variables "PGLOGDIR" and "PGLOGSIZE" are set correctly,
the log file will also be created when the user connect the server with "psql".
Does this follow the specification you have thought?
Is there any option to unset only in that session when you want to connect with "psql"?

Your patch affects the behavior of PQtrace().
The log of the existing PQtrace() is as follows:
From backend> "id"
From backend (#4)> 16387
From backend (#2)> 1
From backend (#4)> 23
Your patch makes PQtrace() including the following log in addition to the above.
To backend> Msg complete, length 27
Start sending message to backend:End sending message to backend:PQsendQuery end :PQgetResult start :Start receiving message from backend:End receiving message from backend:From backend> T

For your information.
Best regards,
Ryohei Nagaura

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2019-01-25 01:37:48 Re: \describe*
Previous Message Thomas Munro 2019-01-24 23:41:17 Re: Synchronous replay take III