Since recently we have been experimenting with BugSnag, a tool that collects exceptions from your application and displays them in a very neat dashboard. It supports a lot of languages already and my colleagues were already implementing the various available libraries (PHP, Node, Angular). However a complete ColdFusion integration wasn’t available yet. So I decided I would write one.
You can download the latest version of bugsnag-coldfusion by cloning it from Github:
- Reports all the usual ColdFusion scopes at the time the exception occured:
- Request headers
- Reports a full stack trace including template content
- Ability to set your own context (URL / action on which the action occured)
- Setting the release stage (development, production etc).
- SSL / No SSL
- ColdFusion 8 or higher or Railo 3.x or higher
- BugSnag account
- Bugsnag API key
Installation / configuration
- Download and extract BugSnag.cfc in your project
- Call the init function on BugSnag.cfc and set your API key
<cfset bugSnag = createObject("component","BugSnag").init( APIKey = "xxxxxxxxxxxxxxxx" <!--- Your API key here ---> )/>
- In your Application.cfc add (or modify) the onError function so that it sends the exception to BugSnag:
<cffunction name="onError" returntype="void" output="false"> <cfargument name="exception" type="any" required="true"/> <!--- Notify BugSnag ---> <cfset bugSnag.notifyError(exception = arguments.exception)/> </cffunction>
Thats it! There are a few extra arguments you can pass to the init() and notifyError() functions which are explained in further detail on the GitHub page of bugsnag-coldfusion.
Hope it helps you out and if you need any help you know how to find me! 😉