Running Mountain Lion. Installed PostgreSQL via Postgres.app. Using postgres for Django via PyCharm. I've read multiple SO and blog posts about getting this to work, and logs simply are not being created.
My conf file (data directory) is located here:
$ ~/Library/Application\ Support/Postgres/var/postgresql.conf
My postgresql.conf logging settings look like this:
log_destination = 'stderr'
logging_collector = on
log_directory = '~/Library/Logs/Postgres' (I've also tried 'pg_log')
I've tried closing and opening Postgres.app
I've also tried restarting the command line server:
$ /Applications/Postgres.app/Contents/MacOS/bin/pg_ctl restart -D ~/Library/Application\ Support/Postgres/var/
...but this results in the terminal hanging on "LOG: autovacuum launcher started"
... and the logs printing to the console.
This SO post is closely relevant, but I want Postgres.app to write to log files, not print to console.
Any help would be awesome, thanks.
EDIT: In response to vyegorov,
version = PostgreSQL 9.2.2
silent_mode does not exist in postgresql.conf
Using Homebrew This can be done by typing the following command into a terminal: This will start up a postgres server hosted locally on port 5432. The server will be run out of the directory /usr/local/var/postgres . This will connect to the server and access the postgres database.
psql -c "SELECT 1" -d {dbname} > /dev/null || postgres -D /usr/local/var/postgres >postgres. log 2>&1 & if you want to check and start postgres in one go (handy for automation scripts).
I got it working for me. Here's the settings I'm using:
log_destination = 'stderr'
logging_collector = on
log_directory = '/tmp/'
log_filename = 'postgresql-%Y-%m-%d.log'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With