On MacOS, I installed PostgreSQL service with brew. Now I want it to log all the executed SQL statements.
Open the file /usr/local/var/postgres/postgresql.conf
, and add these lines to it:
log_statement = 'all'
log_directory = '/tmp/pg_log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
logging_collector = on
log_min_error_statement = error
Please change the log_directory
configuration to your own log directory.
After the configuration, remember to restart the service so that the configuration can take effect.
brew services restart postgresql