Wanted: Opinions on ColdFusion Debugging

ColdFusion has integrated debugging features, and has for a long time. Most CF developers rely heavily on ColdFusion’s ability to append debug output to generated pages, and tags like and and are also used when debugging code. cfstat and PerfMon integration provide some visibility into the CF engine. ColdFusion Studio also features an interactive debugger, a more traditional style debugger which allows for breakpoints and watchpoints and step-by-step execution and real time expression evaluation. Most developers never use the interactive Studio debugger, some find it too hard to configure, others find it flaky, and most find it to be overkill for script type development. C or Java applications, for example, needs interactive debugging because of the potential complexity of such applications. But Web based apps are collections of single pages, execution may be started at arbitrary points, pages may be tested individually, and code can be edited on the fly. As such, interactive debugging never really caught on.
So here’s the question: How would you like ColdFusion debugging to ideally work? What type of debugging would you like, and how would you expect to use it? Do you want an IDE, and if yes what would it do? What visibility do you want into the CF space, and how would you like to gain that visibility? I know this is an open ended question, but if you have any opinions on the subject (I know that you do), please do share.

30 responses to “Wanted: Opinions on ColdFusion Debugging”

  1. Massimo Foti Avatar
    Massimo Foti

    While an interactive debugger would be handy, it’s not on top of my list, especially since I understand it’s not easy to implement such a beast.
    All in all, I have different priorities

  2. Shawn Regan Avatar
    Shawn Regan

    I think CFMX has moved CF debugging in a good direction already. Its really not that big of a deal to debug CF code.

  3. john barbic Avatar
    john barbic

    Most interactive debugging is pretty cumbersome. for this reason, in Coldfusion, I’ve found that there is very little I can’t figure out with a strategically placed <cfabort> and a corresponding <cfoutput>var:#var#</cfoutput>. It is a little time consuming to write out all my variable names sometimes, and I usually have to write a loop or two if I have a query variable I need to *see*, but it’s really pretty straight forward. I could envision some sort of <cfdebug> tag that would dump all my variables at the point in which it appears in my code and maybe optionally abort processing. A small tool like that might be more useful than a full blown solution at first.

  4. Philipp Cielen Avatar
    Philipp Cielen

    check out the <cfdump> tag. You can use that to dump your complete query without having to write a loop. <cfdump var="myQuery">

  5. Brandon Avatar

    IDE debugging would definately help. I use Dreamweaver MX. I think adding a complete set of debugging tools from granular watches to a suite of web application stress tools. Scripting tests would be nice. Unit testing components directly from the MX IDE would help. All that really exists now is integration testing. Run the page and see if it works.

  6. Patrick Steil Avatar
    Patrick Steil

    One of the things the CF app server has been missing for a long time is another utility along the lines of CFSTAT… We need to be able to view what CF pages are executing in real time or in a snapshot view even. Knowing exactly what line of code in what file (custom tag, includ CFC, etc) would be a bonus.
    This is needed when for whatever reason the CF server is getting requests queued up because something has locked up… usually it is caused by an abundance of locks on the databae, but to be able to see this would be great… but it has to be something that looks at this from the outside as when we need to view this CF won’t be serving up any pages….

  7. Sam Farmer Avatar
    Sam Farmer

    Yeah, CFDUMP is a great tag/addition. You will need to put pound signs around the name though:
    <cfdump var="#myQuery#"> otherwise it will just say myQuery!

  8. john barbic Avatar
    john barbic

    Thanks Philipp, it is useful to dump an entire query, but often I use a cfif with a cfloop to create a condtion that dumps only the rows I’m interested in. Also, one issue with cfdump is I can’t get it to label what it dumps (for when I’m dumping a lot of single variables at once). Obviously, I’ve tried entering the everything from the variable name to "yes" in the label attribute of the tag. Am I missing the boat? I’m using CF5 and not sure if this is different in MX.
    Anyway, the simple <cfdebug> tag I envision would work by implicitly picking up all variables (or only the one is a user defined list) at *this* point in processing, label them, and dump them. Maybe, you could specify things like simple vairables only, query only, or whatever. It might also be nice to see how many milliseconds you’re at in the processing cycle at the point the tag appears. I’m sure someone could come up with a nice standard presentation block of info (ah-la Patrick’s post). Just a string to pull if anyone thought it useful.

  9. David Fekke Avatar
    David Fekke

    I just wish ColdFusion MX debugging actually worked correctly. Something happened when when ColdFusion MX came out. The built in error handling stopped showing which line the template was actually errorring on. Sometimes the error was on an included page, and not even on the page the where the error supposedly happened. If ColdFusion would just tell me what line I was errorring on, I would be happy and content. I thought this would be fixed in Red Sky, but it was not. Otherwise, I am happy with the debugging.

  10. Tarantor Avatar

    It is already good and enough.
    Dear Ben,
    I think we need some other priorities such as code compiling etc. as you showed in DevCON 2001.

  11. Oliver Merk Avatar
    Oliver Merk

    There are still those of us who would have liked to see the return of the interactive debugging of CFStudio/CF5 (r.i.p.) in DW2004 and HS+5.5 (rip?).
    That is, the ability to set breakpoints and watch variables as one steps through code. Yes, we all have ways around it and yes, not many people ended up using it because it was so unstable, but the idea was the right one: if CF wants to be considered a premier language, it should offer "true" debugging in one of its IDEs.

  12. Calvin Avatar

    Great question! While I’ve been thinking about what I hope will be be next for ColdFusion, I’ve often come back around to the tools and their interaction with the application server as a major area for improvement.
    ColdFusion is all about making web application development rapid, but with the advent of improved tools and languages from other vendors, CF needs another edge… One area though that has not really been hit well in the web application space, is interactive debugging.
    You mention that Web page apps are collections of single pages, but I couldn’t disagree more. CFCs, custom tags, and includes are far more complex in nature than collections of single pages implies.
    I cannot count the number of times that I wished Server Debug in DWMX (and DWMX 2004) would go the next step.
    I want it to remember all of the url, cookie, form information for any particular page I’m on when I switch to code view, so that I can switch back.
    I want to be able to start at the beginning of my application (which requires a login and therefore a number of user specific variables to be set), and move to the page I’m working on, click a button and have that page open in DWMX.
    I then want to be able to make my code changes, click Server Debug and have it run that page as if I had already walked through the previous steps and output debug information in that very nice Debug output window.
    I want to be able to set breakpoints at the code line level or the page level (includes, cfcs, etc.) and be able to bounce to what I need in the IDE.
    I want the configuration of my local, remote and testing server to provide all the mappings necessary to do this process, and I think it already has enough information.
    And I want it to be in the next version of DWMX along with a small handful of other non-CF specific IDE improvements 😉
    How’s that?
    Thanks for listening!

  13. Alex Gadea Avatar
    Alex Gadea

    I think that CF debugging is already pretty good. There is really no issue that you can’t debug. Two things I would like to see is better error messaging the deeper one gets into nested CFCs. I find that the error messages I receive sometimes (not always) give the line number where a calling CFC invokes another CFC but not the actual line in the invoked CFC where the error occurs.
    I also think it is extremely important to have some way of seeing which pages are currently executing at any given time and which pages have "hung" or are in the process of taking an inordinately long amount of time and the exact line number the page is on. This was always a pet peeve of mine while trying to do CF hosting. If CF could do that, I know many web host engineers would jump for joy ;).

  14. Ryan Avatar

    Setup: I have only used the CFStudio debugging once and am not knowledgeable on what a proper IDE debugger should do.
    The CFDump should show the table columns of a query in the order retrieved. If a database returns columns in randomly (because of select *), try and sort a) alphabetically or b) in the order the table is defined.
    Way to show all running CF files on the server and possibly be able to click on a page and be shown all the values of the variables. This may require a ‘debug’ mode on the server where all page information for debugging is stored temporarily on the server so that even if a page runs in a fraction of a second the server side variables, page flow, etc. can be viewed.
    Being able to compare the client side cookies/cflocation/header information versus what the server thinks it is would be nice.
    Way to show the page execution stack with ALL CF page calls, includes, modules, etc., in the order they were called with potentially a way of outputting all or certain variables on each page. There are times when you have a variable that is being modified and used in a number of self calling pages and seeing what it is at each point would be nice. The current listing of pages that ran is not real helpful because of the way it is summarized out of order, doesn’t include everything, and the query information is lumped at the end so it isn’t clear which page called which query.
    I agree with a previous post saying:
    "I want to be able to start at the beginning of my application (which requires a login and therefore a number of user specific variables to be set), and move to the page I’m working on, click a button and have that page open in DWMX.
    I then want to be able to make my code changes, click Server Debug and have it run that page as if I had already walked through the previous steps and output debug information in that very nice Debug output window."
    Also, we need far better documentation or a set of knowledge base articles we can search on (like Microsoft). I am currently having an Oracle package (stored procedure) call a CFC webservice which calls MS SQL stored procedures. I frequently get Axis Faults which are in CF, but I can’t find any documentation on these ‘known’ faults that it kicks out. For debugging purposes, if MM knows (surely the tech support group has lists) of common error messages CF can create they can make these lists available with explanations on what each one means and how to rectify it.

  15. Nathan Dintenfass Avatar
    Nathan Dintenfass

    I’ll echo what David Fekke and others have said: it would be a great start to get CFMX back to the quality of CF5’s error messages.
    The new customizable debugging is fantastic, but it’s very frustrating how often I get an error message that is either totally confusing in the information it gives or literally gives no information other than there was an error.
    I’ll also add a vote to those who have requested a "console" type application where we can watch CF do what it’s doing under the hood. The stack trace we get in error messages might be interesting for the folks at MACR to debug something wrong in ColdFusion itself, but it is generally totally useless for debugging CFML itself — having a "request trace console" would go a long way towards solving such issues.
    It’s also annoying when many errors thrown by CF during a request result in no "debugging" output being shown (this is especially true of those errors that give no useful information at all).

  16. Jade Avatar

    I am getting used to log4j type of logging and although you can log anything in CF, it has no flexibility as where the logs are stored.
    Logging is a great way for me to track problems and errors due to situations I have not foreseen. However, in a shared environment, this is not an option.

  17. TC Avatar

    I found that Dreamweaver’s Live Server debug pretty useful for IDE based debugging, other than two factors: (1) where I have a login page that has to be executed the first time I attempt to perform live server debug, and (2) inability to provide the page FORM or URL variables initially when clicking on the Live Server Debug icon.
    What I find really frustrating, however, regarding debugging, is debugging Javascript. CF is great when compared with the rudimentary tools for debugging Javascript within IE. That’s were the next focus needs to be (in my view).

  18. Jonathan Avatar

    I’d like to see the ability to customize the debug messages a little bit. For example, on a recent project, I had a bunch of cfdumps of various scopes (session, variable, application, form, url, etc) set up in the OnRequestEnd.cfm page. However, an error would keep OnRequestEnd from executing, and often times the error would be a missing variable, or something not getting passed correctly from one of these scopes. Debugging output shows some of these variables, but not complex variables like structures and arrays.
    Also, debugging queries is extremely difficult when using cfqueryparam since the debug output shows only (param1), (param2), etc instead of the actual values it’s trying to insert.

  19. Steve Nelson Avatar
    Steve Nelson

    I want something that seems like it should be relatively simple. I want the browser to somehow integrate with Homesite. I want to be able to click on an error in the browser and have it open up Homesite to the specific file in the editor and the line number of the error. Most of the time I waste with fixing errors is just find the file and getting the error.

  20. Tim Reilly Avatar
    Tim Reilly

    Are we allowed to presuppose that we have a CFStudio, Homesite+ that is actually an Eclipse plug-in? Then i’d use it as we use WSAD’s jsp debugging.

  21. Matthew Walker Avatar
    Matthew Walker

    I like the window you get in Flash where trace()d data shows up. Would be nice to have an analogue in CF. I often find I am relying on a combination of cfdump and cfabort or a combination of cfdump and cfmail for cfcs called by flash — which is absurd. Possibly I’m missing something….

  22. Charles Tang Avatar
    Charles Tang

    Being able to see what CF is currently running would be a GREAT help. Currently, cfstat just states how many requests are running. Knowing which page(s) are running and the exact line it is running would really help in debugging apps that causes CF to "hang". That single addition would lighten the debugging load tremendously.

  23. yara Avatar

    If you extended the debug window so that it included all variable content including local variable and stuctures eg. if I have a session structure then display the entire structure rather than Struct(n).

  24. surekha Avatar

    I am able to dump the xml file nodes using cfdump.
    But i need to get some of the nodes not all of them.How can i get specified nodes/items without keying the node names etc etc in one go?

  25. Adam Howitt Avatar
    Adam Howitt

    I’d like to see Macromedia develop an interactive debugger for one of their IDEs to help keep new ColdFusion developers on track. As a Senior Developer I’ve worked with many CF newbies and while some may argue that a failure to understand where to place a CFDUMP and a CFABORT represents a bigger problem with the developer and their abilities, I would argue that it is preventing many from migrating from other languages and keeping newbies from understanding what is occuring in a complex application they are asked to maintain.
    A step debugger can also be a valuable training tool for application architectures so that a developer can learn what order pages are included and quickly locate the issues.
    I realize this post was old and potentially dead but I think this would be a big win for new and old developers.

  26. Pierre De Wilde Avatar
    Pierre De Wilde

    An interactive debugger is a critical tool for professional developers.
    Long time ago, Microsoft wrote CodeView, a powerful tool to debug C apps. 20 years later, Macromedia doesn’t understand why an interactive debugger is critical to build apps (feature dropped from ColdFusion Studio).
    Develop a large ColdFusion MX application (thousands of lines code, dozens of CFCs, MVC architecture) and you will understand why an interactive debugger is essential.

  27. Ben Forta Avatar
    Ben Forta

    Pierre, just to play devil’s advocate, Allaire created a step-by-step interactive debugger, and it was the least used feature in the IDE. In fact, most users found it easier to dump output and do simple logging then to set breakpoints and step through code. "Macromedia doesn’t understand why an interactive debugger is critical to build apps" is an inaccurate statement, what I think you meant to say is "So few ColdFusion users ever used the debugger and so Macromedia did not make it a high priority feature to implement". And if that is what you meant, then you’d be right. Other products however, like Flex, do indeed have debugging options available.

  28. Calvin Ward Avatar
    Calvin Ward

    I believe that CF Studio’s debugging was the most unused feature, at least in part, as a result of how difficult it was to setup, and how flaky it was.
    When doing J2EE dev with WSAD, I keep thinking how much faster CF development would be if I had that level of interaction with processes, especially with the advent of CFCs and such as I mentioned before…
    – Calvin

  29. Erwin Tips Avatar
    Erwin Tips

    Still, once applications keep growing (in functionalities), the amount of coding and complexity normally grows equally, and then step-through debugging is needed.
    For a website, interactive debugging is overkill, but maintaining or developing an application, that contains approximately. 10 man-years of work (started in CF 3.1 in 1998, now running on CF MX 6.1/Solaris), with a *lot* of different functionalities, the lost time in not being able to debug by stepping through the code, means a *lot* of wasted time.
    I definitely hope it will soon be possible again. I tried downloading a CFStudio 5 (eval), but can not find them anymore. Does anyone know is it is possible setting up CFStudio 5 with MX RDS ?

  30. Stephane Young Avatar
    Stephane Young

    I miss the interactive debugger in CF Studio now that my company has moved to DWMX as standard development tool.
    Placing <cfdump>, <cfabort>,<cfoutput> …is one way of debugging an application. But it certainly cannot replace a professional interactive debugger. For those who had problems, issues, limitations and wish-list related to the current CFMX error messages, if DWMX had offered an interactive debugger, they would have had another choice to troubleshoot….
    It seems silly that I have to check out files from source control in order to put <cfdump> to "see" what’s going on the server side…
    Lastly, "Allaire created a step-by-step interactive debugger, and it was the least used feature in the IDE" said Ben. It is because the Allaire CF user guide and manual never explained the setup correctly. I only managed to make it work after I bought Ben Forta’s book.

Leave a Reply