Is the PQtrace() API the only way to enable libpq client tracing?
I thought about some environment variable of client configuration setting...
That's generally the job of the client, or more specifically, the driver providing the interface between your program and the libpq API. Unless you are writing at the low level yourself, in which case, you would need to have your program detect an env and call PQtrace() as needed.