Solved

Autmatically email all coldfusion errors to system administrator.

Posted on 2007-11-27
5
609 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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