At times you might want to see what all queries had hit your database, specially while testing and analyzing a solution. Similar need occurred recently in a project using postgres database. One can simply set log_statement flag to ‘all’ in postgresql.conf
postgres@server:/etc/postgresql/9.5/main$ vi postgresql.conf
log_statement = ‘all’ # none, ddl, mod, all
You can also set log_destination in the same file. By default logs will be at
And finally restart postgres server
Please note enable logs on production server is not recommended in normal scenarios as they consume a lot of space.