title: Sinatra Logging & Stack Traces
body: <p>Currently, I'm running an app I'm developing on Apache/Passenger. I was able to view stacktraces when I was using shotgun.</p>
  
  <p>I'm trying to set up logging with Sinatra and really having a hell of a time.  I have my config.ru:</p>
  
  <pre><code>require 'sinatra'
  require 'rubygems'
  
  root = ::File.dirname(__FILE__)
  require ::File.join( root, 'application' )
  
  set :environment, :development
  set :root,  root
  set :app_file, File.join(root, 'application.rb')
  disable :run
  
  configure :development do
    enable :logging, :dump_errors, :raise_errors
  end
  set :show_exceptions, true if development?
  
  run Application.new
  </code></pre>
  
  <p>app.rb:</p>
  
  <pre><code>class App &lt; Sinatra::Base
      logger = ::File.open("log/development.log", "a+")
      STDOUT.reopen(logger)
      STDERR.reopen(logger)
  
      Application.use Rack::CommonLogger, logger
  end
  </code></pre>
  
  <p>Currently, I am able to get general logs, but I don't need general logs. I need to be able to see either in the web browser, or in a log, the server (500) errors that I'm receiving.  Any help is appreciated!</p>