Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails RubyonRails-将异常堆栈跟踪添加到500错误页?_Ruby On Rails_Ruby On Rails 3 - Fatal编程技术网

Ruby on rails RubyonRails-将异常堆栈跟踪添加到500错误页?

Ruby on rails RubyonRails-将异常堆栈跟踪添加到500错误页?,ruby-on-rails,ruby-on-rails-3,Ruby On Rails,Ruby On Rails 3,我有一个Rails 3应用程序,当前当出现内部错误时,它会显示下列页面之一: ./views/exceptions/internal_server_error.html.haml ./views/exceptions/internal_server_error.json.erb ./views/exceptions/internal_server_error.html.haml ./views/exceptions/internal_server_error.json.erb 如何让HTML50

我有一个Rails 3应用程序,当前当出现内部错误时,它会显示下列页面之一:

./views/exceptions/internal_server_error.html.haml ./views/exceptions/internal_server_error.json.erb ./views/exceptions/internal_server_error.html.haml ./views/exceptions/internal_server_error.json.erb
如何让HTML500错误页面显示异常的堆栈跟踪?我运行的是Apache而不是Webrick,我希望在生产和开发模式下都显示异常,因为这是一个内部应用程序。我尝试在internal_server_error.html.haml页面中显示@exception,但未填充该页面。

如果要在生产中显示完整的堆栈跟踪,请在
配置/environments/production.rb中注释掉以下行:

config.consider_all_requests_local = false

这是一个非常糟糕的名称,但Rails使用它来确定是否连接异常处理中间件。

它只在我们将值设置为
true
时起作用,而不是注释它,即。,
config.consive\u all\u requests\u local=true

这是在生产环境中还是在开发环境中?我假设是在生产环境中,因为默认的webrick显示错误。我希望在生产环境和开发环境中都显示错误。我们使用apache作为前端。我想首先在开发模式下测试这一点,我的development.rb行包含“config.consived_all_requests_local=true”,这是否意味着异常中间件已用于我的开发版本?我有一个由“/views/exceptions/internal_server_error.html.haml”生成的自定义500页“文件,我只想在那里显示异常名称和stacktrace。中间件会对您定义的任何静态500文件进行攻击。这是您在开发模式下获得的标准异常页面。我在development.rb中已经有了“config.consude_all_requests_local=true”,并且从未获得错误的堆栈跟踪,我总是被重新定向到“/views/exceptions/internal_server_error.html.haml”,在我的例子中,它只显示一些文本,没有异常信息。您正在运行哪个版本的rails?这绝对不是Rails 3中的默认行为:(另外,由于它正在呈现haml,我假设您手动放置了该视图模板?请尝试删除它。异常处理中间件可能会向它寻求覆盖