RE: libpq debug log

Started by Iwata, Ayaalmost 7 years ago1 messages
#1Iwata, Aya
iwata.aya@jp.fujitsu.com

Hi Nagaura-san,

Thank you for your review and advice.

This merit was very helpful for my use, so I want your proposal function in
postgres.

Thank you. 

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

Sure. I will change separator character to "-" and add timezone information.

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

Yes. The purpose of the line message is to check the value of the set parameter.
I will change it to you suggest.

3)
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"?

There are no option to not output log when connected by "psql".
It is not good to create lots of empty files. I think that the cause of this issue is that the initialization location of the new trace log is not good.
I will fix it so that logs are not output when connected to "psql".

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

Thank you for finding it. I will fix not to affect PQtrace().

Regards,
Aya Iwata