Check out the "log_statement" option in the postgresql.conf file (there's an entire section (18.7) in the docs about logging).
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных