Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Autmatically email all coldfusion errors to system administrator.

Posted on 2007-11-27
5
Medium Priority
?
617 Views
Last Modified: 2013-12-24
Is there a way to have coldfusion MX 7 automatically email the error details of all errors to an email account without haveing to add code to every single page.
0
Comment
Question by:bjv211
  • 3
  • 2
5 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 20361027
Set up an error handler in your Application.cfm/cfc file and use <cfmail...>  to email the error message details to whatever account you want.

Method 1:
Use <cferror type="exception" template="yourErrorHandlerPage.cfm" ..> in your Application.cfm/cfc file. On yourErrorHandlerPage.cfm dislay an error message for the user and use <cfmail> tags to email the error details.

Method 2:
Use the onError method to display an error message for the user and use <cfmail> tags to email the error details.

You can read more about it here:
"Handling Errors"
http://livedocs.adobe.com/coldfusion/7/htmldocs/00001130.htm#1220254
0
 
LVL 1

Author Comment

by:bjv211
ID: 20361555
ok i've added this to my application.cfm
<cferror type="request" template="../../../error.cfm" mailto="serveradmin@company.com" exception="any">

and this to my error.cfm

<cfmail to="#error.MailTo#" from="CF_Server@company.com" subject="#error.DateTime#">
#error.Diagnostics#
#error.HTTPReferer#
</cfmail>

however, the cfmail isn't mailing and it outputs everything within <cfmail> in the body  

I have cfmail tags in many applications on this server, so I know it isn't a mail config issue.

0
 
LVL 52

Expert Comment

by:_agx_
ID: 20367486
You're using a different "type" than in my example.  You can only CFML tags in a type="exception" handler.  They're not allowed for type="request".  

See here for more info
http://livedocs.adobe.com/coldfusion/7/htmldocs/00001138.htm#1106836
0
 
LVL 1

Author Comment

by:bjv211
ID: 20367641
sweet, its working now! thank you.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 20367691
Welcome :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question