Search code examples
postgresqlloggingosx-mountain-lionpsql

How do I enable logging with Postgres.app on OS X?


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


Solution

  • 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'