Skip to main content
Ben Nadel at InVision In Real Life (IRL) 2019 (Phoenix, AZ) with: Kenny Bundy
Ben Nadel at InVision In Real Life (IRL) 2019 (Phoenix, AZ) with: Kenny Bundy

Writing To The Standard Out / Console Using WriteDump() In Adobe ColdFusion 2021

Published in

As I'm starting to modernize my ColdFusion blogging platform, one thing that I am missing terribly from Lucee CFML is the ability to write to the standard out (stdout) and standard error (stderr) streams. In a Docker / containerized context, writing to the output streams is a powerful debugging tool (not to mention a log aggregation technique). A few months ago, I looked at porting the systemOutput() function from Lucee CFML to Adobe ColdFusion; but, I just recently discovered that the CFDump tag and the writeDump() function in Adobe ColdFusion can write directly to the "console" (Standard Out) instead of to the browser. This isn't as seamless as systemOutput(); but, it may just be good enough!

Historically - and by default - the CFDump tag and the writeDump() function output data to the browser. When combined with the CFAbort tag, dumping data continues to be one of the easiest ways to debug a ColdFusion application. However, halting the control-flow of an application isn't always the best thing to do; and, if the processing is taking place in a background / asynchronous thread, outputting to the browser may not even be possible.

In such situations dumping the data to the server's output stream allows data to be debugged without terminating the contextual process. With the CFDump tag and the writeDump() function, we can use the attribute / argument output="console" to direct the dump to the standard out stream:


		var = "Testing writeDump() to the console!",
		output = "console"
		var = "Testing cfdump to the console!",
		output = "console"

	writeOutput( "Done!" );


If we run this Adobe ColdFusion code and monitor the server's output stream, we'll see this (taken using CommandBox sever log --follow):

[INFO ] Testing writeDump() to the console!
[INFO ] Testing cfdump to the console!

As you can see, both the CFDump tag and the writeDump() function can write the data to the output stream without aborting the current page request.

Lucee CFML NOTE: When you run the same code in Lucee CFML, the value is prepended with the data type, ex [INFO ] string Hello world!. Of course, in Lucee CFML, we can just use systemOutput() so this minor incompatibility is really a non-issue.

This is really minor; but, it's definitely something I'm going to use for debugging as I update my ColdFusion blogging platform!

Want to use code from this post? Check out the license.

Reader Comments

Post A Comment — I'd Love To Hear From You!

Post a Comment

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel