pg_net icon indicating copy to clipboard operation
pg_net copied to clipboard

Optionally log based on status code responses

Open chasers opened this issue 4 years ago • 3 comments
trafficstars

Can we optionally log something based on the status code when the response is handled?

Default to logging 4xx - 5xx response codes would be great, and then everyone would automatically get this info in their Postgres logs.

chasers avatar Oct 21 '21 16:10 chasers

Yeah, that can be done by using a call to elog in the background worker.

Can we optionally log something based on the status code when the response is handled?

We should have a config to turn this on/off, maybe named like pg_net.log_http_errors(off by default).

steve-chavez avatar Oct 21 '21 17:10 steve-chavez

Do all responses get put in the table you collect responses from? Maybe we just build a UI over that? I thought I read somewhere a concept of sync vs async, but maybe either way they end up in the collect response table?

I'm assuming actual connection errors will end up in the logs though. Is this correct?

chasers avatar Oct 21 '21 20:10 chasers

The response table is private API and subject to breakage, so we should probably avoid that. But yes, they end up in the response table.

I don't think we log connection errors right now, only for debugging purposes.

soedirgo avatar Oct 22 '21 02:10 soedirgo