To view your Mac system logs, launch the Console app. You can launch it with Spotlight search by pressing Command+Space, typing “Console,” and then pressing Enter. You'll also find it at Finder > Applications > Utilities > Console. The Console app, also known as Console.
The location of the log file will depend on the configuration. On Debian-based systems the default is /var/log/postgresql/postgresql-9.3-main. log (replace 9.3 with your version of PostgreSQL). On Red Hat-based systems it is located in /var/lib/pgsql/data/pg_log/ .
In the Console app on your Mac, select Log Reports in the sidebar. If the Log Reports category isn't visible, click the Sidebar button . Select the file you want to locate, then choose File > Reveal in Finder. A Finder window appears with the log file selected.
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/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
.
On OS X, if you're using the EnterpriseDB installation of PostgreSQL, your log files will be in /Library/PostgreSQL/8.4/data/pg_log
Of course, you'll want to substitute 8.4 for whichever version number you're running.
For Apple M1(Big Sur) users who installed postgres using homebrew the location is -
/opt/homebrew/var/log/postgres.log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With