PostgreSQLでログを取得するためには、postgresql.confファイルでlog_statementとlog_min_error_statementを設定します。 例えば、全てのSQL実行と警告レベル以上のエラーを記録するには以下のように設定します。
log_statement = 'all' log_min_error_statement = warning
上記設定後、再起動すると有効となります。
su -c "/usr/local/pgsql/bin/pg_ctl -w restart" - postgres waiting...