Skip to main content
Participating Frequently
March 3, 2023
Question

Viewing variables when debugging (vscode with ColdFusion Builder extension) without HTML output

  • March 3, 2023
  • 3 replies
  • 462 views

Hello.

 

It seems that to be able to view variables when debugging, I have to turn on Enable Request Debugging Output, which causes a whole bunch of information to be appended to the returned HTML.
If a whole bunch of HTML is returned in each response, the application I'm debugging doesn't really work, as it expects a certain kind of output (basic strings or xml) and the extra HTML messes that up.

 

How can I view variables while debugging, but not get all of that extra HTML that breaks the application?

    This topic has been closed for replies.

    3 replies

    BKBK
    Community Expert
    Community Expert
    March 20, 2023

    Use <cflog> or <cfdump> to write the XML response to file. For example:

    <cfsavecontent variable="xmlResult" >
    <?xml version="1.0" encoding="utf-8"?>
    	<note>
    	<to>Jack</to>
    	<from>Jim</from>
    	<heading>Reminder</heading>
    	<body>Don't forget this weekend!</body>
    	</note> 
    </cfsavecontent>
    
    <cflog text="#xmlResult#" file="xmlResult">
    <cfdump var="#xmlResult#" format="text" output="#getDirectoryFromPath(getCurrentTemplatePath())#result.xml">

     

    That code will write the XML content to a log file and to a file (result.xml) in the current directory.

     

    Nevertheless, <cfdump format="text"> seems to have a bug in ColdFusion 2021. It appends a line containing asterisks ***... to the output. I have reported it: https://tracker.adobe.com/#/view/CF-4217397    

    thumboAuthor
    Participating Frequently
    March 20, 2023

    I'm not quite getting how this will fix the issue.

    Would cfdump return the file contents to the client?

    Does that break viewing variables in the debugger?

    And it also looks like this is something I'd have to do this in every file that's a target of an AJAX call?

    BKBK
    Community Expert
    Community Expert
    March 20, 2023

    My suggestion is not meant as a fix for the issue. It is instead a workaround.

    It enables you to view the XML result separately from the debug output.

    Community Expert
    March 6, 2023

    I'm not sure if this is still in CF, but there used to be a way you could specify the request debugging output go to a new browser window instead of the existing browser window.

     

    Dave Watts, Eidolon LLC

    Dave Watts, Eidolon LLC
    thumboAuthor
    Participating Frequently
    March 3, 2023

    I'm also getting these errors when trying to inspect variables in vscode:

    589 :: Error on parsing server response
    Error on variablesRequest

    It seems to work fine in ColdFusion Builder, though the issue with the HTML output is the same of course.