Console logging using SystemOutput

edit

Console Logging

Most CFML developers are familiar with <cfdump> for debugging. SystemOutput() is similar but writes to the console - useful for CLI scripts, background tasks, and CI environments.

Like <cfdump>, it can output both text and complex objects. The second argument addNewLine controls whether a newline is added (default: false).

Access the Console

  • Tomcat: catalina run in tomcat\bin
  • CommandBox: box server start --console
  • CI/CD: Output appears directly in job logs

Example

<cfscript>
	array = [ 1, "array", now() ]
	systemOutput( array, true );
	struct = { lts: 5.4, stable: 6.2 };
	systemOutput( struct, true );
	query = queryNew( "id,name", "numeric,varchar", [ [ 1, "lucee" ], [ 2, "ralio" ] ] );
	systemOutput( query, true );
	systemOutput( "starting ftp <print-stack-trace>", true );
</cfscript>

Produces the following output in the console:

[1,"array",createDateTime(2025,8,14,17,9,0,242,"Europe/Berlin")]
{"STABLE":6.2,"LTS":5.4}
query("id":[1,2],"name":["lucee","ralio"])
starting ftp
java.lang.Exception: Stack trace
        at lucee.runtime.functions.other.SystemOutput.call(SystemOutput.java:62)
        at lucee.runtime.functions.other.SystemOutput.call(SystemOutput.java:42)
        at console_cfm$cf$1.call(/console.cfm:8)
        at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1112)
        at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1006)

See also