Book Image

Learning Heroku Postgres

By : Patrick Rafael de Oliveira Espake
Book Image

Learning Heroku Postgres

By: Patrick Rafael de Oliveira Espake

Overview of this book

Table of Contents (17 chapters)
Learning Heroku Postgres
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Keyword List
Index

Log statements


The first step is to ensure that you have access to all logs in real time. The Heroku client provides the heroku logs command that allows you to view all logs collected by the Logplex in a unified manner. Using this command, you can filter through the postgres process to view only database logs. You can also use the -t option (tail); this opens a continuous stream of data logs. Here is an example:

$ heroku logs -p postgres -t --app your-app-name
2014-11-01T23:41:42Z app[postgres.10]: [CHARCOAL] checkpoint complete: wrote 0 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.000 s, sync=0.000 s, total=0.004 s; sync files=0, longest=0.000 s, average=0.000 s

This way, you can view the logs generated by your Postgres database, perform the diagnosis, and identify the common errors.

The heroku logs command provides the following options to display the recent log output:

  • -n, --num NUM: This refers to the number of lines to display

  • -p, --ps PS: This only...