Platinum Partner
architects,devops,tips and tricks,tools & methods

Configuring Logging for Postgres.app

Problem

You're using Postgres.app on a Mac for local development but are getting SQL errors from your application. You're seeing an error message:

ERROR:  current transaction is aborted, commands ignored until end of
transaction block

This isn't very useful.

Solution

Turn on logging and watch the log files when the error is generated.

This is done by editing~/Library/Application Support/Postgres/var/postgresql.conf and setting:

logging_collector = on
log_directory = 'pg_log'

then restarting Postgres to pick up the new settings. You can then watch the log files to find out which queries are failing:

$ tail -f ~/Library/Application Support/Postgres/var/pg_log/*

Discussion

By default, Postgres.app does not have logging enabled which makes local debugging difficult.

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}