:::: MENU ::::

Rick Groenewegen · Senior Coldfusion, SQL, NodeJS and Mobile developer

Senior Coldfusion, SQL, NodeJS and Mobile developer

ColdFusion Bugsnag notifier

  • Oct 15 / 2015
  • 0
debug
Coldfusion

ColdFusion Bugsnag notifier

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.

Download

You can download the latest version of bugsnag-coldfusion by cloning it from Github:

https://github.com/RickGroenewegen/bugsnag-coldfusion

Features:

  • Reports all the usual ColdFusion scopes at the time the exception occured:
    • URL
    • Form
    • Request headers
    • Session
    • Client
    • CGI
    • Cookie
  • 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

The requirements:

  • ColdFusion 8 or higher or Railo 3.x or higher
  • BugSnag account
  • Bugsnag API key

Installation / configuration

  1. Download and extract BugSnag.cfc in your project
  2. Call the init function on BugSnag.cfc and set your API key
    <cfset bugSnag = createObject("component","BugSnag").init(
     APIKey = "xxxxxxxxxxxxxxxx" <!--- Your API key here --->
    )/> 
  3.  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! 😉

Leave a comment

Need to know more? Contact me!