简体   繁体   English

在Rails中替代不推荐使用的exception_notification gem?

[英]Alternative to deprecated exception_notification gem in Rails?

I have, successfully, been using the exception_notification gem for many different apps and it is working fine in terms of my workflow etc. I like the reports, the convenience of getting emails etc. The gem hasn't been updated for 8 years (!) but still works fine with one exception - it bloats the memory for every 500-error. 我已经成功地在许多不同的应用程序中使用了exception_notification gem ,它在我的工作流程等方面运行良好。我喜欢报表,获取电子邮件的便捷性等。gem已有8年没有更新了(! ),但仍然可以正常工作,但有一个例外-每出现500个错误就会使内存膨胀。 Maybe it is just my implementation of the app but I am quite sure I have done it according to spec (it will be another question in that case). 也许这只是我对应用程序的实现,但是我很确定我已经按照规范完成了(在这种情况下,这将是另一个问题)。

I have googled but can't find another gem that does the same thing: send me an email when my app crashes with a 500-error. 我已经在Google上搜索过,但是找不到另一个做同样的事情:当我的应用程序崩溃并出现500错误时,给我发送电子邮件。 What alternatives are there to the exception_notification gem? exception_notification gem有哪些替代方法?

There is already a forked version of this gem Exception notification . 此gem Exception通知已存在一个分支版本。 Explanation says: 说明说:

The Exception Notification gem provides a set of notifiers for sending notifications when errors occur in a Rack/Rails application. 异常通知gem提供了一组通知程序,用于在机架/导轨应用程序中发生错误时发送通知。 The built-in notifiers can deliver notifications by email, Campfire, HipChat, Slack, Mattermost, IRC or via custom WebHooks. 内置通知程序可以通过电子邮件,Campfire,HipChat,Slack,Mattermost,IRC或通过自定义WebHooks传递通知。

So this is more enhanced version which can be used with multiple 3rd party applications. 因此,这是可以与多个第三方应用程序一起使用的增强版本。 The link mentioned in github explain clearly the steps to start using this gem: Read me for Exception Notification github中提到的链接清楚地说明了开始使用此gem的步骤:请向我阅读有关异常通知的信息

The mailing options and code is pretty much same: 邮件选项和代码几乎相同:

Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix         => "[PREFIX] ",
:sender_address       => %{"notifier" <notifier@example.com>},
:exception_recipients => %w{exceptions@example.com},
:delivery_method => :smtp,
:smtp_settings => {
  :user_name => "bob",
  :password => "password",
  }
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM