Why do I use BugLog
BugLogHQ is an open source Coldfusion application that gives you a powerful error logging and reporting service for any website.
Since it works as a webservice, it's platform agnostics. So it can log errors from PHP developed websites as well as CFM or DOTNET websites.
Download and install buglog application from http://bugloghq.riaforge.org/
(I recommend installing it in an separated server.)
More informations available at http://www.oscararevalo.com/index.cfm/BugLogHQ
Just follow the next three steps and enjoy :
1) SET UP YOUR CONFIG FILE
Add the following code to config/=coldbox.cfc :
coldbox = {
// Declare the exception handler
exceptionHandler = "Main.onException",
onInvalidEvent = "Main.onPageNotFound"
}
// Replace "Main" by your handler's name
webservices = {
// Declare the BugLog's webservice
BugLog = "http://MyBugLogServer/bugLog/listeners/bugLogListenerWS.cfc?wsdl"
}
// Replace "MyBugLogServer" by your server IP/Hostname
settings = {
// Declare the BugLog email recipient
bugEmailRecipients = "MyEmail"
}
//Replace "MyEmail" by one or multiple coma separated emails to receive errors by mail if BugLog's webservice is unreacheable
2) SET UP YOUR EXCEPTION HANDLER
// Add the following code to handlers\YourExceptionHandler.cfc where
"YourExceptionHandler.cfc" is your exception handler filename
<cffunction name="onException" access="public" output="false" returntype="void">
<cfargument name="event" type="any">
<cfscript>
//Grab the Exception From the request collection
var oExceptionBean = event.getValue("ExceptionBean");
getPlugin(plugin="BugLog",customPlugin=true).logError(oExceptionBean);
</cfscript>
</cffunction>
// replace "YourWebsiteURL" by the URL of your website
<cffunction name="onPageNotFound" access="public" output="false" returntype="void" >
<cfargument name="event" type="any">
<cfscript>
var rc = event.getCollection();
var url = "http://YourWebsiteURL"
var controller = application.cbController;
var exceptionService = controller.getExceptionService();
var ExceptionBean = "";
try {
$throw(message="The request '#CGI.SCRIPT_NAME#' is
invalid",detail="This error is generated when the request doesn't match a
valid event",type="404");
} catch (any e){
ExceptionBean = exceptionService.ExceptionHandler(e,e.type,e.message);
getPlugin("BugLog",true).logError(ExceptionBean,"info");
}
</cfscript>
<cflocation url="#url#" addtoken="false" statusCode="300">
</cffunction>
3) ADD THE PLUGIN
Just drop the BugLog.cfc file into your application plugins directory (/plugins/)