简体   繁体   English

Ruby on Rails:生产环境的详细错误日志

[英]Ruby on Rails : Detailed error logs for a production environment

Whenever runnning in production, RoR displays only warnings and errors, which is fine. 每当在生产中运行时,RoR仅显示警告和错误,这很好。

Howver, the logger does not display detailed information about the error : no timestamp, no IP address, no user request. 但是,记录器不会显示有关该错误的详细信息:没有时间戳,没有IP地址,没有用户请求。

I tried creating a custom Logger, but it does not allow me to get the IP address and actual user request without using evil methods (since it's within a model). 我尝试创建一个自定义Logger,但是它不允许我在不使用恶意方法的情况下获得IP地址和实际用户请求(因为它在模型中)。

Ideally, I'd like to have messages such as : 理想情况下,我希望收到以下消息:

 Started GET "/api/request?" for 89.80.x.x at Mon Nov 21 17:29:08 +0100 2011 

And the strack trace of the error below. 和下面的错误的跟踪。 But these should only be displayed for warnings and errors, and the end user should not see them( so consider_all_requests_local should be off). 但是,这些仅应显示为警告和错误,并且最终用户不应看到它们(因此,应该关闭think_all_requests_local)。

Any way to achieve this ? 有什么办法可以做到这一点?

Exceptions in production mode should not happen often, so I went for this gem: Exception Notification . 生产模式下的异常不应经常发生,因此我选择了这个宝石: Exception Notification

An exception in production mode should be dealt with immediately so this is (for me at least) better then logging the error. 生产模式下的异常应立即处理,因此(至少对我来说)比记录错误要好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 生产错误中的Ruby on Rails - Ruby on Rails in production error 生产环境中的Solr初始化失败,并且在轨道上有红宝石 - Solr Initialization failure in production environment with ruby on rails 如何查看Engine Yard上部署的Rails应用程序的生产环境日志 - How to check the production environment logs of rails application deployed on Engine Yard 502 Rails生产环境的网关错误? - 502 Bad gateway error for rails production environment? 在Rails生产环境中过滤错误报告 - Filtering error reports in rails production environment 在红宝石中,为什么某些控制器在生产环境中不起作用? - In ruby on rails, why some controller does not work in the production environment? Heroku生产环境中不存在Ruby on Rails应用程序页面 - Ruby on Rails Application Page Does Not Exist in Heroku Production Environment Ruby on Rails应用程序在生产环境中找不到样式表和JavaScript? - Ruby on Rails application can not find stylesheets and javascript in production environment? 使用ROR(ruby on rails)生产环境未发送某些电子邮件 - Some email not delivered using ROR(ruby on rails 3) production environment ruby on rails:heroku:“生产”环境缺少“secret_key_base” - ruby on rails: heroku: Missing `secret_key_base` for 'production' environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM