1

I'm just starting out with Ruby and with the sinatra framework. I've got a setup going now with heroku and I'm totally amazed how well it works. There is just one thing that I can't figure out. How do I debug stuff? Might sound weird but I have this variable that I'd like to print out and see, preferably in the terminal or something like that. How do I do this in ruby with forman running? When I write print or puts nothing shows upp in the foreman logging...

Thanks!

Joel
  • 3,166
  • 5
  • 24
  • 29

1 Answers1

3

If you're using Foreman, try adding a log: process to your Procfile. For Rails apps, my Procfile looks like so:

web: bundle exec rails server thin -p $PORT -e $RACK_ENV
log: tail -f -n 0 log/development.log

You'll want to configure Sinatra to log to a file, in my example log/development.log.

Locally, Foreman will automatically spin up a log process and spit the logs out to the terminal, similar to how what you see on Heroku. On Heroku, no log process will be ran unless you manually scale it (which you don't want anyway).

catsby
  • 11,276
  • 3
  • 37
  • 37