Where are the PostgreSQL logs on macOS?
The plist
used to launch your Postgres on boot may also set the logfile:
$ dir ~/Library/LaunchAgents
org.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
.
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"
On OSX Homebrew installation the log can be found at:
Latest Homebrew:
/opt/homebrew/var/log/postgres.log
or older:
/usr/local/var/log/postgres.log
or for older version of postgres (< 9.6)
/usr/local/var/postgres/server.log
Bonus - check if PostgreSQL is running using Homebrew:
brew services info --all