Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku: How can you check Heroku Error Logs?

I've got a PHP application on a free Heroku account. Today for no apparent reason I got Heroku's Application Error screen for about an hour. No downtimes on Heroku's status report page.

I'd like to check the logs to figure out why the application was down.. But have no idea how to do this! Can somebody please help me?

like image 883
Allen S Avatar asked Jan 23 '14 10:01

Allen S


People also ask

Why does heroku show application error?

"Application Error" or similar is always caused by your own application code. Routing errors will normally only surface themselves within the logs of your application. In most cases, you will be able to see the cause of the error there. To learn more about logging, please see our Logging article on DevCenter.

How do I debug my Heroku app?

If running heroku local does not help, run a remote shell: heroku run -a <your app name> /bin/bash , and there run npm start to see the logs and debug the issue on the Heroku server. I like this answer the most because it also shows an alternative if you don't have Linux or Mac.

What is the purpose of the command heroku logs?

Log Runtime Metric LogsTo monitor load and memory usage for apps running in Dynos, Heroku Labs offers a feature called “log-runtime-metrics.” The CLI command $ heroku logs --tail can be used to view statistics about memory and swap use, as well as load averages, all of which flow into the app's log stream.


2 Answers

Simply use heroku logs to display the last 100 lines of your logs.

Or to tail the logs in real-time: heroku logs -t

Heroku only saves the last 1500 lines of logs, which you can access using heroku logs -n 1500. If you want more logging, check out Heroku add-ons like Logentries or Papertrail.

like image 98
Mike Avatar answered Sep 24 '22 10:09

Mike


$ heroku logs -t --app app-name

This gives you all current logs (logentries add-on would be used)

like image 40
Charles Skariah Avatar answered Sep 22 '22 10:09

Charles Skariah