gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 17:17:52 26 4
gpt4 key购买 nike

我有:

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

最佳答案

如果您不想向每个页面添加一个 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>

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

<!--- 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#">

关于coldfusion - Coldfusion 有没有办法将所有错误发送到特定的电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24317956/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com