Ron
Ron

Reputation: 6755

Postgresql on Homebrew Mac: How to log statements?

I set the log_statement = 'all' in postgresql.conf, but so far I am still not able to view the log. So my questions are: 1. Am I doing right to turn log on? 2. Where is log stored if it is working?

Cheers, Ron

Upvotes: 1

Views: 1801

Answers (3)

Yan Burtovoy
Yan Burtovoy

Reputation: 306

Despite on any values in postgresql.conf file regarding to log settings, my postgres log file located here: /usr/local/var/log/[email protected]

Upvotes: 1

Scott Dugas
Scott Dugas

Reputation: 415

In /usr/local/var/postgres/postgresql.conf set the following (note, you may be able to leave some of these as defaults):

log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_file_mode = 0600
log_statement = 'all'

And create the directory /usr/local/var/postgres/pg_log It will then create a log file in that directory.

Upvotes: 1

Eelke
Eelke

Reputation: 22063

Most common method is to set log_destination to stderr (which is the default) and to set logging_collector to true (it is probably false in your case). The logging collector will capture the stderr and write the errors from the different backends to log files in the pg_log directory under your postgres data directory.

Upvotes: 1

Related Questions