Trace and ajax in CF9

I was having an issue with an ajax call failing. Of course I thought there was something wrong in the cfc so I added a few more trace statements which didn't help. I finally decided to examine the stacktrace and it pointed (eventually) to the line where the trace occured. I removed that trace and the exception moved to the next trace line. I know I may be in the slow group but I see a pattern here. After removing all the trace statements the code worked fine.

It is a bit ironic that one's first impulse is to add some trace statements to troubleshoot which only exacerbates the problem!

Changing the inline attribute to false had no effect.

If you uncheck the debug setting: "Enable request debugging output" in CFAdministrator the ajax call works fine but the output from the trace is not written to the trace.log file

If you surround the trace with a try catch you will see the exception message is: Variable DEBUGGER is undefined.

Code to duplicate: testtrace_cfc.cfc
component {
	remote string function doesitfail( String input)
		returnformat="JSON" {
		try{
			trace( text="#arguments.input#" inline="false" );
			writelog( file="mylog" text="#arguments.input# was entered");
		} 
		catch( any ex){
			writelog(file="mylog" text="#ex.message#");
		}
		return ucase(arguments.input);

	}
}
Calling Template:
<cfparam name="url.inString" default="No input">
<cfajaxproxy cfc="com.vawter.testtrace_cfc"  jsclassname="testTrace">
	<script language="JavaScript" type="text/javascript">
	     oT=new testTrace();
	     oT.setCallbackHandler(successh);
	     oT.setErrorHandler(errorh);
	     
             function successh(data){
		alert(data);
	     }
	     function errorh(data){
	       alert("failed "+data);
	     }
	</script>
	
	<cfoutput><a href="##" onclick='oT.doesitfail("#url.instring#");return false;'>click me</a></cfoutput>

For the above code the ajax call succeeds because the exception is caught and the return statement is executed despite the error.

Workaround:

Use writelog instead of trace

The problem also occurs in CF8.

Comments
Sam Farmer's Gravatar I've found writelog to be very useful in these situations...in fact it was a presentation by Raymond Camden that showed it to me first along with the Tailview option in CFBuilder which is a great way to read logs.
# Posted By Sam Farmer | 2/3/10 8:04 AM
Don Vawter's Gravatar Followup. The bug has been submitted to Adobe and verified by them.
# Posted By Don Vawter | 2/4/10 7:14 AM
Ryan's Gravatar We are experiencing this issue also, do you know if this was fixed in the 9.0.1? Or what bug id is it so that I can go vote for it.
# Posted By Ryan | 7/22/10 3:56 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.4.001. Contact Blog Owner