Where are the PostgreSQL logs on macOS?

前端 未结 8 1763
慢半拍i
慢半拍i 2020-12-12 15:57

I would like to take a look at the PostgreSQL log files to see what my app writes to them but I can\'t find them.

Any ideas?

相关标签:
8条回答
  • 2020-12-12 16:31

    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"

    0 讨论(0)
  • 2020-12-12 16:33

    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
    
    0 讨论(0)
  • 2020-12-12 16:34

    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.

    0 讨论(0)
  • 2020-12-12 16:41

    I have different Postgresql versions installed on my mac (with macports), and all the logs can be found here

    /opt/local/var/log/postgresql84/postgres.log
    /opt/local/var/log/postgresql91/postgres.log
    /opt/local/var/log/postgresql92/postgres.log
    
    0 讨论(0)
  • 2020-12-12 16:43

    Postgresapp 9.3.5.1 and later keep a server log. The log is inside the data directory, named postgres-server.log.

    0 讨论(0)
  • 2020-12-12 16:49

    If you are using Postgres.app, you can find the Data Directory location in the Preferences dialog box. In that directory, the log is at postgres-server.log.

    For example, on my machine, the log is at /Users/nofinator/Library/Application Support/Postgres/var-9.4/postgres-server.log.

    0 讨论(0)
提交回复
热议问题