Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Configuring Logging for Postgres.app

DZone's Guide to

Configuring Logging for Postgres.app

· DevOps Zone
Free Resource

Download the blueprint that can take a company of any maturity level all the way up to enterprise-scale continuous delivery using a combination of Automic Release Automation, Automic’s 20+ years of business automation experience, and the proven tools and practices the company is already leveraging.

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.

Download the ‘Practical Blueprint to Continuous Delivery’ to learn how Automic Release Automation can help you begin or continue your company’s digital transformation.

Topics:

Published at DZone with permission of David Winterbottom, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}