0
私はエアブレーキを設定しようとしていますが、それは分かりません。私が達成したいのは、生産からのエラーであるdevelopment
とtest
のenvsではありません。heroku + railkのエアブレーキ設定
しかし、次の設定では、3つのタイプのエラーメッセージがすべてプロダクションで発生しています。したがって、プロダクションエラーはプロダクションエラー通知を送信しますが、開発/テストエラーもプロダクションエラー通知を送信します。
正しく設定するにはどうすればよいですか?
# Configures the environment the application is running in. Helps the Airbrake
# dashboard to distinguish between exceptions occurring in different
# environments. By default, it's not set.
# NOTE: This option must be set in order to make the 'ignore_environments'
# option work.
# https://github.com/airbrake/airbrake-ruby#environment
c.environment = :production
# Setting this option allows Airbrake to filter exceptions occurring in
# unwanted environments such as :test. By default, it is equal to an empty
# Array, which means Airbrake Ruby sends exceptions occurring in all
# environments.
# NOTE: This option *does not* work if you don't set the 'environment' option.
# https://github.com/airbrake/airbrake-ruby#ignore_environments
c.ignore_environments = %w(test, development)
kyrylo、hahaha。私は配列を正しく送り返すために 'irb'を置いています。どういうわけか私はそれを逃した:)。 'c.environment =:production 'は、公式ドキュメントのものです。 Rails.envについては混乱しています。ドキュメントは 'デフォルトでは設定されていません 'と言っていますが、デフォルト値は' Rails.env'です。これは私と矛盾しているようです。 –
デフォルトでは、ライブラリとしてのairbrake-rubyはそれを設定しません。しかし、エアブレーキ宝石にはRailsアプリがRails.envを使う可能性が高いことを知っているRailsイニシャライザがあるので、便利に設定することができます。ドキュメントに関しては、 'ignore_environments'のシンボルも使用するので、この動作は一貫しています。ハッピーエアブレーディング! – kyrylo