2012-04-30 4 views
0

나는 내 응용 프로그램에서 오류를 처리하기위한 예외 알리미를 사용하고 /config/initializers/exception_notification.rb에서 나는 다음과 같습니다프로덕션 모드에서만 예외 알림?

MyAPP::Application.config.middleware.use ExceptionNotifier, 
    :email_prefix => "[ERROR] ", 
    :sender_address => '"Notifier" <[email protected]>', 
    :exception_recipients => ['[email protected]'] 

을하지만 알림 이메일이 어떻게에서만 생산 모드에서 이메일을 전송 할 수 있습니다, 개발 모드로도 전송됩니다?

답변

4

각 환경에 대해 ExceptionNotifier를 개별적으로 구성 할 수 있습니다. See also the documentation. 레일 3 ExceptionNotification의로

그래서 당신이 당신의 config.ru 파일에 해당 옵션을 구성 할 수 있습니다, 랙 미들웨어로 사용, 또는 환경에서 당신은 그것을 실행할. 대부분의 경우 프로덕션 환경에서 ExceptionNotification을 실행해야합니다.

예를 들어 config/environments/production.rb에서 구성하면됩니다.

Whatever::Application.config.middleware.use ExceptionNotifier, 
    :email_prefix => "[Whatever] ", 
    :sender_address => %{"notifier" <[email protected]>}, 
    :exception_recipients => %w{[email protected]} 

a nice blog entry handling this topic도 있습니다.

관련 문제