有没有办法Coldfusion可以将所有错误发送到特定的电子邮件?

use*_*637 2 coldfusion coldfusion-9

我有:

服务器详细信息
服务器产品ColdFusion
版本9,0,1,274733
版本标准
操作系统Windows Server 2008
OS版本6.0
Adobe驱动程序版本4.0(Build 0005)
我是否可以接收coldfusion上发生的特定电子邮件的所有错误?

Wil*_*ill 9

如果您不想向每个页面添加cferror,可以向application.cfc添加onError方法,只要有任何页面出错,就会调用此函数.

 <cffunction name="onError">
    <!--- The onError method gets two arguments:
    An exception structure, which is identical to a cfcatch variable.
    The name of the Application.cfc method, if any, in which the error
    happened. --->
    <cfargument name="Except" required="true"/>
    <cfargument type="String" name = "EventName" required="true"/>
     error handling goes here 
</cffunction>
Run Code Online (Sandbox Code Playgroud)

我还看到你有一个问题,你担心邮件服务器无法正常工作.如果您担心自己无法收到有关错误的电子邮件,可以将其记录到文件中.

<!--- Log all errors in an application-specific log file. --->
<cflog file="filename" type="error" text="Event Name: #Eventname#" >
<cflog file="filename" type="error" text="Message: #except.message#">
Run Code Online (Sandbox Code Playgroud)