开发者

Sinatra Logging & Stack Traces

开发者 https://www.devze.com 2023-03-13 05:39 出处:网络
Currently, I\'m running an app I\'m developing on Apache/Passenger. I was able to view stacktraces when I was using shotgun开发者_运维技巧.

Currently, I'm running an app I'm developing on Apache/Passenger. I was able to view stacktraces when I was using shotgun开发者_运维技巧.

I'm trying to set up logging with Sinatra and really having a hell of a time. I have my config.ru:

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

app.rb:

class App < Sinatra::Base
    logger = ::File.open("log/development.log", "a+")
    STDOUT.reopen(logger)
    STDERR.reopen(logger)

    Application.use Rack::CommonLogger, logger
end

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!


Moved enable :logging, :dump_errors, :raise_errors, :show_exceptions into my app.rb and things seem to have worked from there.

0

精彩评论

暂无评论...
验证码 换一张
取 消