Skip to content

Instantly share code, notes, and snippets.

@timothyklim
Forked from ericallam/gist:1019446
Created April 25, 2014 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timothyklim/11282047 to your computer and use it in GitHub Desktop.
Save timothyklim/11282047 to your computer and use it in GitHub Desktop.

Open the postgresql.conf config file:

$> mate /usr/local/var/postgres/postgresql.conf

Uncomment the line with 'log_destination' and set it to 'syslog'

log_destination = 'syslog'

Open the syslog config:

$> mate /etc/syslog.conf

And add this line:

local0.*    /var/log/postgresql

Then just restart syslog and postgresql

$> ps aux | grep syslog
$> sudo kill -2 PID

$> launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
$> launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist

Now you can tail the log file and see the queries that rails runs:

$> tail -f /var/log/postgresql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment