To log all queries which are processed on PostgreSQL 8.4 or 9.3 server you have to enable / add / change these lines in your postgresql.conf file:
- log_statement = all
- log_min_error_statement = error
- log_min_duration_statement = 0
useful is also:
- log_line_prefix = ‘%t %c %u ‘ # info on begin of the log line – time sessionid user
And reload configuration – it should be sufficient.
If not – restart your postgres server.
But be aware that server log will grow very quickly with this logging. For example – after 2 minutes of tests in my application I have got ca. 70 MB log file.
Additional note: You can also enable logging in particular session:
- SELECT set_config(‘log_statement’, ‘all’, true);
But it stops when you end this particular session.