Where are the PostgreSQL logs on macOS? Where are the PostgreSQL logs on macOS? postgresql postgresql

Where are the PostgreSQL logs on macOS?


On OSX Homebrew installation the log can be found at:

/usr/local/var/log/postgres.log 

or for older version of postgres (< 9.6)

/usr/local/var/postgres/server.log


Just ask your database:

SELECT     * FROM     pg_settings WHERE     category IN( 'Reporting and Logging / Where to Log' , 'File Locations')ORDER BY     category,    name;

In my case, it's in "/Library/PostgreSQL/8.4/data/pg_log"


The plist used to launch your Postgres on boot may also set the logfile:

$ dir ~/Library/LaunchAgentsorg.postgresql.postgres.plist$ cat ~/Library/LaunchAgents/org.postgresql.postgres.plist<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict>  [...]  <key>StandardErrorPath</key>  <string>/usr/local/var/postgres/server.log</string></dict></plist>

So in this case, /usr/local/var/postgres/server.log.