Looking at Logs

If something goes wrong with your application in Heroku this is where you look: the log file.

When you run your Sinatra application on your local machine, you see a tonne of useful information about what’s happening in the Terminal window. Heroko stores this to a log file and you can look it up.

To view the contents of this log file, you can use the following command

heroku logs --tail

This will show the most recent additions to the log file. You’ll get a lot of stuff like this:

2014-07-07T11:42:26.829065+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2014-07-07T11:42:35.334415+00:00 app[web.1]: I, [2014-07-07T11:42:35.334301 #2]  INFO -- : listening on addr=0.0.0.0:19146 fd=9
2014-07-07T11:42:35.707657+00:00 app[web.1]: I, [2014-07-07T11:42:35.707293 #5]  INFO -- : worker=0 ready
2014-07-07T11:42:35.772074+00:00 app[web.1]: I, [2014-07-07T11:42:35.771727 #11]  INFO -- : worker=2 ready
2014-07-07T11:42:35.767750+00:00 app[web.1]: I, [2014-07-07T11:42:35.764688 #2]  INFO -- : master process ready
2014-07-07T11:42:35.777268+00:00 app[web.1]: I, [2014-07-07T11:42:35.777006 #8]  INFO -- : worker=1 ready
2014-07-07T11:42:35.618291+00:00 heroku[web.1]: State changed from starting to up

Visit your application in the browser again, and you’ll see another log message generated.

Press Control+C to stop streaming the logs.

×

Subscribe

The latest tutorials sent straight to your inbox.