DevOps Zone is brought to you in partnership with:

I work at Tangent Labs, a digital agency, writing applications in python and django. I spend most of my free time hacking. I run commandlinefu.com and am the author of the e-commerce framework django-oscar amongst other things. I used to be a mathematician; I have a PhD in Mathematics from the University of Nottingham and an associated interest in cryptic crosswords, chess and playing devil's advocate. David is a DZone MVB and is not an employee of DZone and has posted 27 posts at DZone. You can read more from them at their website. View Full User Profile

Configuring Logging for Postgres.app

01.16.2013
| 1918 views |
  • submit to reddit

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 David Winterbottom, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)