Retrieving the value of $1, $2 etc. from a Postgres Query
If you set log_min_duration_statement = 0 in postgresql.conf and reload, all statements and the parameter values will be written to the log file.

Warning: on a busy system, logging all statements can be a bottleneck.