Heroku: How can you check Heroku Error Logs?
Solution 1:
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.
Solution 2:
$ heroku logs -t --app app-name
This gives you all current logs (logentries add-on would be used)
Solution 3:
heroku logs --tail
With above command you can see continuous heroku logging.
Solution 4:
Heroku is awesome but debugging applications on Heroku can be tedious. While technically all you need is $ Heroku logs --tail --app *and-your-app-name*
that might not always paint the whole picture.
There are limitations like the 1500 loglines size or the 1mb buffer allowed for the response that you need to consider. For the average Joe this is plenty and most of us don't even worry about them.
But every now and then you run into one of those limitations or maybe you don't run in a limitation per se but you do have to sift through countless lines of logs to find that one little message.
This is where most developers will look for outside help. There are plenty of tools that will manage your logs without breaking the bank or if money is no issue, well, there are services for that scenario too.
The most popular ones would be:
- Sematext.com
- Datadoghq.com
- Logdna.com
- logz.io
Here's how a service like that would look like.