Re: libpq debug log
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: "Iwata, Aya" <iwata.aya@jp.fujitsu.com>,
"Jamison,
Kirk" <k.jamison@jp.fujitsu.com>,
"Nagaura,
Ryohei" <nagaura.ryohei@jp.fujitsu.com>,
Jacob Champion <pchampion@pivotal.io>, Jim Doty <jdoty@pivotal.io>,
PostgreSQL mailing lists <pgsql-hackers@postgresql.org>,
"nagata@sraoss.co.jp" <nagata@sraoss.co.jp>,
Haribabu Kommi <kommi.haribabu@gmail.com>,
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Date: 2019-02-22T18:51:56Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > On Thu, Feb 21, 2019 at 7:52 PM Iwata, Aya <iwata.aya@jp.fujitsu.com> wrote: >> Aside from problems with my current documentation which I will fix, >> could you explain more detail about the problem of the design? > We already have a PQtrace() facility that could be improved, and it > has been previously suggested that you work on improving this facility > rather than inventing something new. I still think that's a good > idea. Me too. PQtrace as currently constituted might be helpful for debugging libpq itself, but it's nigh useless for any higher-level purpose. I'd gladly toss overboard any hypothetical use-case for what it does now, in favor of having something that dumps stuff at the logical level of messages. (It's not even very consistent, because somebody did add a more-or-less-message-level printout to pqSaveParameterStatus, which I believe is duplicative of what fe-misc.c will print about the same interaction at the byte level.) > Instead you've created a second way of producing similar > information, and then coupled it to very specific ideas about how that > information should be logged: it is triggered by new libpq parameters, > there is log rotation logic, etc. Those might not be right for > everyone, and there's no flexibility in the mechanism. Good point. To the extent that people want any of that, they'd probably want to have application control over it. Maybe, in addition to PQtrace(FILE *) that'd just dump to a stdio stream, there should be a way to create a callback similar to a notice-message hook, and let the application implement such features in a custom callback. > I am not sure that it's a good idea to have facilities that write to > the local filesystem that can be triggered by libpq parameters. Oy. That seems like a *very* serious objection. I agree with Robert's thought that it'd be better to insist on application involvement in enabling trace output. regards, tom lane
Commits
-
Rename PQtraceSetFlags() to PQsetTraceFlags().
- d0e750c0acaf 14.0 landed
-
Suppress length of Notice/Error msgs in PQtrace regress mode
- e7e341409a3d 14.0 landed
-
Strip file names reported in error messages on Windows, too.
- 53aafdb9ff6a 14.0 landed
-
Fix setvbuf()-induced crash in libpq_pipeline
- a68a894f0198 14.0 landed
-
libpq_pipeline: Must strdup(optarg) to avoid crash
- dde1a35aee62 14.0 landed
-
Remove setvbuf() call from PQtrace()
- 6ec578e60101 14.0 landed
-
Initialize conn->Pfdebug to NULL when creating a connection
- aba24b51cc1b 14.0 landed
-
Disable force_parallel_mode in libpq_pipeline
- a6d3dea8e5e0 14.0 landed
-
libpq_pipeline: add PQtrace() support and tests
- 7bebd0d00998 14.0 landed
-
Improve PQtrace() output format
- 198b3716dba6 14.0 landed
-
Re-simplify management of inStart in pqParseInput3's subroutines.
- d3a557894ce0 11.12 landed
- d2be6cdc55ad 10.17 landed
- a98e53e10dd5 9.6.22 landed
- 56defbdd0f4e 12.7 landed
- 51c54bb60309 14.0 landed
- 3580b4a0cde0 13.3 landed