Skip to main content
Ben Nadel at CFUNITED 2008 (Washington, D.C.) with: John Mason
Ben Nadel at CFUNITED 2008 (Washington, D.C.) with: John Mason@john_mason_ )

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

By on

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!

NEW: Some basic markdown formatting is now supported: bold, italic, blockquotes, lists, fenced code-blocks. Read more about markdown syntax »
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.