title: How do you debug a Sinatra app like a Rails app?
body: <p>In my main Sinatra controller, I want to debug the params hash after it is POSTed from a form.</p>
  
  <p>I have added:</p>
  
  <pre><code>puts params.inspect
  </code></pre>
  
  <p>and</p>
  
  <pre><code>set :logging, :true
  </code></pre>
  
  <p>The <code>params.inspect</code> works if everything goes well. But if an error happens before the controller is executed I'm not getting any information about the error like I would in Rails by default.</p>
  
  <p>What's the best way to get useful debug info?</p>
  
  <p><a href="http://www.nickhammond.com/2009/03/28/easy-logging-with-sinatra/" rel="noreferrer">This example</a> did not work at all (the app wouldn't even start after I added this code):</p>
  
  <pre><code>configure do 
    Log = Logger.new("sinatra.log")
    Log.level  = Logger::INFO 
  end
  </code></pre>
  
  <p>followed by:</p>
  
  <pre><code>Log.info "#{@users.inspect}"
  </code></pre>