grails - 来自 Grails 的关于 Grails 错误的电子邮件通知

标签 grails

有没有办法在 Grails 站点上发生 Grails 错误时向自己发送详细信息?
设置它的最佳方法是什么?在一个地方? (试图保持干燥)

我想包括产生错误的 URL。

最佳答案

.
如果您打算捕获项目中发生的任何异常并将其邮寄,那么我正在使用这样的设置,并且我通过以下方式进行了操作:
.

  • 在 TagLib 中创建了一个标签:
    def reportError = {attrs, body ->
            String error = body()
            //error will have the Error Details, you can mail this string :)
            //mail example
            mailService.mailError(error) //just an example
            //if you want to show the error on the error page
            out << error
            //if you want to show any custom message
            out << "Error mailed, check Email"
     }
    
  • 在 GSP 页面 View /error.gsp 中替换“ "标记为 " "

  • 全部做完... :)

    现在发生的事情是,每当发生异常(即使在 AJAX 调用中)请求被重定向到错误页面时,我们都可以捕获所有错误。

    此设置不起作用的唯一地方是未绑定(bind)在请求上的执行,即:JOBS。

    在这种方法中,我能够捕获所有未预料到的异常:)
    ..

    我就是这样做的,希望有帮助:)

    问候库沙尔

    关于grails - 来自 Grails 的关于 Grails 错误的电子邮件通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8436047/

    相关文章:

    spring - 使用 Grails Spring DSL 进行依赖注入(inject)

    grails - 使用参数创建 url,并在其他 gsp 页面 grails groovy 中使用它们

    gwt - 有人碰巧看到了 Grails+GWT 项目的 Maven 原型(prototype)吗?

    Grails 2.3.4 数据库 View 作为域类

    java - 为什么 grails 不能在同一个端口上运行两个应用程序?

    grails - 升级jvm8 grails run-app后无法启动

    grails - 将 groovy sql 的 sql.eachRow() 存储到列表中

    java - 使用 grails 配置 Hibernate

    java - 无法初始化代理 - 无 session

    java - Grails/MySQL与 jetty worker 组成