Send an e-mail when a specific logging event occurs, typically on errors or fatal errors.

By default, an email message will be sent when an ERROR or higher severity message is appended. The triggering criteria can be modified by setting the evaluatorClass property with the name of a class implementing TriggeringEventEvaluator, setting the evaluator property with an instance of TriggeringEventEvaluator or nesting a triggeringPolicy element where the specified class implements TriggeringEventEvaluator.

Grails supports sending all log messages (error,fatal etc.) to a support team or to yourself, by email, via log4j with SMTP Appender. I have used the services of Mandrill Email Service to send emails from my application. You can use the email service provided by Gmail, SendGrid, etc.

 

To send custom messages in email messages, use the following in catch block: