views:

329

answers:

2

I wrote a teeny tiny Sinatra app that runs fine, locally, but for some reason as soon as I put it online, all I get is 'Internal Server Error'.

How do I get the logging output?

I'm running on Dreamhost with passenger, using the instructions from the Sinatra book.

So I added to more handlers:

get '/hello/:name' do
  "Hello, #{params[:name]}!"
end

get '/nokogiri-test/' do
  doc = Nokogiri::HTML(open('http://www.google.co.il/search?q='+params[:query]))
  res = ''
  doc.xpath('//li//h3//a').each do |li|
    res+= li.content + '<br />'
  end
  res
end

The first one works fine, the second throws an error. I'm not interested in why there's an error. I'm interested in how to get feedback for it and resolve errors in the future.

A: 

If you're seeing apache's Internal Server Error message, you should be able to check the apache error log to find out what's going on. I think on dreamhost the log file is stored in /home/your_user_name/logs/yourdomain.com/http/error.log

jhickner
the error logs are blank:http://pastebin.ca/1706753
Jono
Finding where the errors get logged would really help to debug a running application. Any idea?
Jono
+1  A: 

Ah! The answer comes from here.

Never would have thought to look in there, but I got desperate. The solution is to set the environment to :development:

set :environment, :development

I stuck that into my configuration files and it produced all the error output. Still doesn't solve my problem if I ever want to discover what's causing an error in a PRODUCTION app... So how would I solve that?

Jono