Cold Fusion

Documentation - Raygun4cfml - ColdFusion Error Reporting

The raygun4cfml provider

Raygun4cfml is a library that you can add to your ColdFusion/CFML application. Once installed it will transmit all exceptions to your dashboard. Installation only takes a few minutes so you can start receiving error and crash reports right away.

Supported CFML engines:

  • Adobe ColdFusion 9+
  • Railo 4.0+
  • Lucee 4.5+‚Äč

Current Version: 1.1.0 (Jan 2 2016)


  • Testbox 2 (for running unit and BDD tests only)

How do I get started with raygun4cfml?


Option 1 (preferred):

Use Commandbox and Forgebox to get the library and then follow the ideas outlined in 'Library organisation' for further setup.

To get the latest from the master repository

box install raygun4cfml 

To install a specific release or tag: 

box install git://{tagname}

Example tag names are 1.1.0,, etc. Please check the list of tags on Github. Be aware that if you install any tag from before I introduced support for Commandbox and Forgebox there won't be a box.json file and therefore Commandbox will give you a warning as well as there won't be any dependency management for such an installation of the library.

Shortcut for the above:

box install MindscapeHQ/raygun4cfml#{tagname}

To get the latest from my development repository (be warned, this might contain all sorts of untested code):

box install TheRealAgentK/raygun4cfml

Option 2:

Fork and clone the repo to your local system. Move the src/test directories into places of your choice and suitable for your system and follow the ideas outlined in 'Library organisation'.

Option 3:

Download a zip file containing the current content of the repo or a release/tag of your choice. Unzip the resulting file. Move the src/test directories into places of your choice and suitable for your system and follow the ideas outlined in 'Library organisation'.


(1) Options 2 and 3 will not fulfill any necessary dependencies, you're on your own.

Library Organization & Instantiation

/src contains the source code. The package structure is but the library's components themselves are independent of the package path. Therefore you can use the library in multiple ways:

Put the content of /src into your webroot and instantiate RaygunClient through something like the following:

raygun = createObject("component","").init(

Put the contents of /src into any other place of your choice and create a mapping to /nz in your server administrator or through code and then use the instantiation code as above.

Put the contents of the raygun4cfml into a place of your choice where your CFML has some sort of a mapping pointing towards and and just instantiate RaygunClient like this:

raygun = createObject("component","RaygunClient").init(

/samples contains a set of files that show how the library can be used in your code through a global error handler as well as a contributed example for ColdBox 3.6

/tests contains manual tests as well as a structure (but no tests at this stage) for Testbox unit and BDD tests.

Example error handler

The following is an example for use in a global error handler template e.g cferror. It also demonstrates how you can add custom data to every message delivered to Raygun.

    raygun = createObject("component","").init(
        apiKey = "YOURAPIKEYHERE"

    result = raygun.send(error);



Tags can be sent with each error like this:

tags = ["coding","db","sqlfail"];
raygun = createObject("component","").init(
	apiKey = variables.RAYGUNAPIKEY

result = raygun.send(issueDataStruct=error,tags=tags);

Custom Data

Custom data objects can be created and sent with each error:

customUserDataStruct = {"session" = {"memberID" = "5747854", "memberFirstName" = "Kai"}, "params" = {"currentAction" = "IwasDoingThis", "justAnotherParam" = "test"}};
customUserData = createObject("").init(customUserDataStruct);

raygun = createObject("component","").init(
	apiKey = variables.RAYGUNAPIKEY
result = raygun.send(issueDataStruct=error,userCustomData=customUserData);

Sending user data

Data for the affected user which experienced the error can be attached like this:

userIdentifier = createObject("").init(Identifier="",isAnonymous=false,UUID="47e432fff11",FirstName="Test",Fullname="Tester");
raygun = createObject("component","").init(
	apiKey = variables.RAYGUNAPIKEY

result = raygun.send(issueDataStruct=error,user=userIdentifier);

Filtering sensitive data

You can remove sensitive data (e.g financial data or credentials) from error payloads using a content filter:

filter = [{filter = "password", replacement = "__password__"}, {filter = "creditcard", replacement = "__ccnumber__"}];
contentFilter = createObject("").init(filter);

raygun = createObject("component","").init(
    apiKey =  variables.RAYGUNAPIKEY,
    contentFilter = contentFilter

result = raygun.send(error);

Raygun4cfml GitHub Repository

To get the source code, visit the GitHub repository here.

Documentation missing?

If we don't have documentation about your desired topic, send us a message and we'll create it for you.