Skip to content

Instantly share code, notes, and snippets.

@ericallam
Created June 10, 2011 18:35

Revisions

  1. Eric Allam created this gist Jun 10, 2011.
    27 changes: 27 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    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