Question

I would like to use the ColdFusion Request Debugging Output from the context of my CFC web service. Is this possible? Here is a sample CFC that I've tried to access:

/cfjunk/jsonBug.cfc:

<cfcomponent output="true">

<cffunction name="test" returntype="string" access="remote" returnformat="json" output="true">
    <cfset local.str = structNew()>
    <cfsetting showDebugOutput= "true">
    <cfscript>
    str = {a = "hello", b = JavaCast("int", 23)};
    </cfscript>
    <cfreturn SerializeJSON(local.str)>
</cffunction>

</cfcomponent>

Requested via http://localhost:8500/cfjunk/jsonBug.cfc?method=test with Request Debugging turned on, yielding no actual debugging output. As you can see, I've tried to force the issue by specifying showDebuggingOutput="true", to no avail.

Was it helpful?

Solution

The behavior of debugging output in ColdFusion, within the context of direct CFC calls is slightly different between versions.

The latest version, ColdFusion 9.0.1, suppresses this debug information from the browser output. Therefore, you'll need another mechanism to debug CFCs directly, either by tracing/tailing the log, encapsulating all the CFC calls within a CFM that you can successfully display debugging output on, or opt to use an external debugger to monitor the calls, ie. Firebug, Chrome Developer Tools or Charles.

In ColdFusion 8 and earlier, as well as the un-hotfixed ColdFusion 9.0, this debug information is displayed in the browser output.

Source: Change in CFCs with Debugging and ColdFusion 9

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top