Whatever message this page gives is out now! Go check it out!
<cfdump
var = "#variable#"
output = "browser|console|file"
format = "text|html"
abort = "true|false">
label = "text"
metainfo = "yes|no"
top = "number of rows|number of levels"
show = "columns|keys"
hide = "columns|keys"
keys = "number of keys to display for structures"
expand = "yes|no"
showUDFs = "yes|no">Attribute | Req/Opt | Default | Description |
var | Required | Variable to display. Enclose a variable name in number signs. These kinds of variables yield meaningful cfdump output:
| |
expand | Optional | yes |
|
format | Optional | text | Use with the output attribute to specify whether to save the results of a cfdump to a file in text or HTML format. |
hide | Optional | all | For a query, this is a column name or a comma-delimited list of column names. For a structure, this is a key or a comma-delimited list of keys. If you specify a structure element that doesn't exist, ColdFusion ignores it and does not generate an error. |
keys | Optional | 9999 | For a structure, the number of keys to display. |
label | Optional | A string; header for the dump output. Ignored if the value of the var attribute is a simple types. | |
metainfo | Optional | yes for query{{no}} for persistence CFCs | For use with queries and persistence CFCs. Includes information about the query in the cfdump results, including whether the query was cached, the execution time, and the SQL. Specify metainfo="no" to exclude this information from the query result. For persistence CFCs, if metainfo="yes", returns property attributes such as getters and setters. |
output | Optional | browser | Where to send the results of cfdump. The following values are valid:
|
show | Optional | all | For a query, this is a column name or a comma-delimited list of column names. For a structure, this is a key or a comma-delimited list of keys. |
showUDFs | Optional | yes |
|
top | Optional | 9999 | The number of rows to display. For a structure, this is the number of nested levels to display. |
abort | Optional | false | If this attribute is set to "true", it stops processing the current page at the tag location. |
<cfif IsXmlDoc(mydoc) is "yes">
<cfdump var="#mydoc#">
</cfif><!--- This example shows how to use this tag to display the CGI scope as a structure: --->
<cfdump var="#cgi#"><!--- This displays information about file objects. --->
<cfscript>
myfile = FileOpen("c:\temp\test1.txt", "read");
</cfscript>
myfile refers to:
<cfdump var="#myfile.filepath#"><!--- class name --->
<cfset boolVal = true>
<cfdump var ="#boolVal.getClass()#"><cfset obj = createObject("java", "java.io.File")>
<cfdump var="#obj#" ><cfscript>
nestedArr = [[1, 2, 3], ["a", "b", "c"], [true, false]];
writedump(var="#nestedArr.getClass()#");
</cfscript><cfscript>
// Simulate calling a payment gateway API
function processPayment(amount, cardNumber) {
// In real scenario, this would be an actual API call
// Example: result = httpService.post(paymentGatewayURL, paymentData);
var apiResponse = {
"status": "error",
"transaction_id": "TXN-" & createUUID(),
"amount": amount,
"currency": "USD",
"timestamp": now(),
"error": {
"code": "INVALID_CARD",
"message": "Card number validation failed",
"details": {
"field": "card_number",
"reason": "Invalid checksum"
}
},
"metadata": {
"processor": "StripeGateway",
"api_version": "2023.1",
"request_id": "req_" & randRange(10000, 99999)
}
};
return apiResponse;
}
// Process a payment
paymentResult = processPayment(99.99, "4111111111111111");
</cfscript>
<h2>Payment API Response Debugger</h2>
<!--- Use cfdump to display the complete API response structure --->
<cfdump
var="#paymentResult#"
label="Payment Gateway API Response"
expand="yes">
<!--- For production environments, output to a log file instead --->
<cfif isDefined("url.debug") AND url.debug EQ "logfile">
<cfdump
var="#paymentResult#"
output="#getTempDirectory()#payment-debug.html"
format="html"
label="Payment Debug Log - #dateFormat(now(), 'yyyy-mm-dd')# #timeFormat(now(), 'HH:mm:ss')#">
<p>Debug information saved to: #getTempDirectory()#payment-debug.html</p>
</cfif>
<!--- Display specific error information if present --->
<cfif structKeyExists(paymentResult, "error")>
<h3>Error Details:</h3>
<cfdump
var="#paymentResult.error#"
label="Error Object"
expand="yes">
</cfif><cfscript>
// Simulate a complex customer order query
// In real scenario, this would query your actual database
customerOrderQuery = queryNew(
"orderID,customerName,orderDate,productName,quantity,unitPrice,totalAmount,status",
"integer,varchar,date,varchar,integer,decimal,decimal,varchar"
);
queryAddRow(customerOrderQuery, [
{
orderID: 1001,
customerName: "John Smith",
orderDate: dateAdd("d", -5, now()),
productName: "Laptop Computer",
quantity: 1,
unitPrice: 1299.99,
totalAmount: 1299.99,
status: "Shipped"
},
{
orderID: 1002,
customerName: "John Smith",
orderDate: dateAdd("d", -3, now()),
productName: "Wireless Mouse",
quantity: 2,
unitPrice: 29.99,
totalAmount: 59.98,
status: "Delivered"
},
{
orderID: 1003,
customerName: "John Smith",
orderDate: now(),
productName: "USB Cable",
quantity: 3,
unitPrice: 9.99,
totalAmount: 29.97,
status: "Processing"
}
]);
</cfscript>
<h2>Customer Order History - Debug View</h2>
<!--- Display complete query with metadata --->
<cfdump
var="#customerOrderQuery#"
label="Customer Order Query Results"
metainfo="yes"
expand="yes">
<hr>
<!--- Show only specific columns --->
<h3>Simplified View (Selected Columns Only)</h3>
<cfdump
var="#customerOrderQuery#"
label="Order Summary"
show="orderID,orderDate,productName,totalAmount,status"
top="10">
<hr>
<!--- Hide sensitive columns --->
<h3>Customer Service View (Sensitive Data Hidden)</h3>
<cfdump
var="#customerOrderQuery#"
label="Orders (Public View)"
hide="unitPrice,customerName">
<!--- Output to console for server-side debugging --->
<cfif isDefined("url.debug") AND url.debug EQ "console">
<cfdump
var="#customerOrderQuery#"
output="console"
label="Query Console Debug">
<p>Query data sent to console (check ColdFusion logs)</p>
</cfif>
<!--- Display query statistics --->
<cfscript>
queryStats = {
"totalRecords": customerOrderQuery.recordCount,
"totalOrderValue": dollarFormat(arraySum(customerOrderQuery["totalAmount"])),
"averageOrderValue": dollarFormat(arrayAvg(customerOrderQuery["totalAmount"])),
"columnList": customerOrderQuery.columnList
};
</cfscript>
<h3>Query Statistics</h3>
<cfdump var="#queryStats#" label="Summary Stats"><cfscript>
// Initialize session data (simulating a real user session)
session.user = {
"userID": 12345,
"username": "jsmith@example.com",
"firstName": "John",
"lastName": "Smith",
"role": "customer",
"loginTime": now(),
"lastActivity": now(),
"isAuthenticated": true,
"preferences": {
"theme": "dark",
"language": "en",
"notifications": true,
"currency": "USD"
}
};
session.shoppingCart = {
"cartID": "CART-" & createUUID(),
"items": [
{
"productID": 501,
"name": "Wireless Keyboard",
"quantity": 1,
"price": 79.99
},
{
"productID": 502,
"name": "Monitor Stand",
"quantity": 2,
"price": 45.00
}
],
"subtotal": 169.99,
"tax": 13.60,
"total": 183.59,
"createdAt": dateAdd("h", -2, now()),
"lastUpdated": now()
};
session.navigation = {
"currentPage": getCurrentTemplatePath(),
"previousPage": "/products/index.cfm",
"pageHistory": ["home", "products", "cart"],
"visitCount": 5
};
</cfscript>
<!--- Security check: Only show in development mode --->
<cfif isDefined("application.environment") AND application.environment EQ "development">
<h2>Session Data Inspector</h2>
<p><strong>Environment:</strong> Development Mode</p>
<p><strong>Session ID:</strong> #session.sessionID#</p>
<!--- Display entire session scope --->
<cfdump
var="#session#"
label="Complete Session Scope"
expand="no"
top="5">
<hr>
<!--- Display user information only --->
<h3>User Session Data</h3>
<cfdump
var="#session.user#"
label="User Information"
expand="yes">
<hr>
<!--- Display shopping cart with sensitive data hidden --->
<h3>Shopping Cart Contents</h3>
<cfdump
var="#session.shoppingCart#"
label="Cart Debug"
expand="yes"
hide="cartID">
<hr>
<!--- Show only specific user fields --->
<h3>Authentication Status</h3>
<cfdump
var="#session.user#"
label="Auth Info"
show="userID,isAuthenticated,loginTime,lastActivity">
<!--- Log session data to file for persistent debugging --->
<cfif isDefined("url.logSession")>
<cfset debugFileName = "session-debug-" & session.user.userID & "-" & dateFormat(now(), "yyyymmdd-HHMMSS") & ".html">
<cfdump
var="#session#"
output="#getTempDirectory()##debugFileName#"
format="html"
label="Session Debug Log - User #session.user.userID#">
<p style="color: green;">Session data logged to: #getTempDirectory()##debugFileName#</p>
</cfif>
<cfelse>
<!--- Production environment - don't expose session data --->
<h2>Session Debugging Disabled</h2>
<p>Session debugging is only available in development environments for security reasons.</p>
</cfif>
<!--- Display session statistics without sensitive data --->
<cfscript>
sessionInfo = {
"sessionExists": structKeyExists(session, "user"),
"isLoggedIn": structKeyExists(session, "user") AND session.user.isAuthenticated,
"cartItemCount": structKeyExists(session, "shoppingCart") ? arrayLen(session.shoppingCart.items) : 0,
"sessionAge": structKeyExists(session, "user") ? dateDiff("n", session.user.loginTime, now()) & " minutes" : "N/A"
};
</cfscript>
<h3>Session Summary (Safe for all environments)</h3>
<cfdump var="#sessionInfo#" label="Session Stats"><!--- Create a simple upload form --->
<cfif NOT isDefined("form.fileUpload")>
<h2>File Upload Debugger</h2>
<p>Upload a file to see detailed information about the upload process.</p>
<form method="post" enctype="multipart/form-data">
<div style="margin: 20px 0;">
<label for="fileUpload">Select a file to upload:</label><br>
<input type="file" name="fileUpload" id="fileUpload" required>
</div>
<div>
<button type="submit">Upload and Analyze</button>
</div>
</form>
<!--- Show request information for debugging upload issues --->
<h3>Current Request Information</h3>
<cfscript>
requestInfo = {
"templatePath": getCurrentTemplatePath(),
"requestMethod": isDefined("form") ? "POST" : "GET",
"formSubmitted": structKeyExists(form, "fileUpload")
};
</cfscript>
<cfdump
var="#requestInfo#"
label="Request Information"
expand="yes">
<cfelse>
<!--- File was uploaded, process and analyze it --->
<h2>File Upload Analysis</h2>
<cfscript>
// Define upload directory (use temp directory for demo)
uploadDir = getTempDirectory() & "uploads/";
// Create directory if it doesn't exist
if (!directoryExists(uploadDir)) {
directoryCreate(uploadDir);
}
</cfscript>
<!--- Perform the file upload --->
<cftry>
<cffile
action="upload"
fileField="fileUpload"
destination="#uploadDir#"
nameConflict="makeunique"
result="uploadResult">
<h3>✓ Upload Successful</h3>
<!--- Display complete upload result --->
<cfdump
var="#uploadResult#"
label="File Upload Result Object"
expand="yes">
<hr>
<!--- Get additional file information --->
<cfscript>
uploadedFilePath = uploadResult.serverDirectory & "/" & uploadResult.serverFile;
fileInfo = getFileInfo(uploadedFilePath);
</cfscript>
<!--- Display detailed file information --->
<h3>Extended File Information</h3>
<cfdump
var="#fileInfo#"
label="File System Details"
expand="yes">
<hr>
<!--- Create a summary object with key information --->
<cfscript>
uploadSummary = {
"originalFileName": uploadResult.clientFile,
"serverFileName": uploadResult.serverFile,
"fileSize": numberFormat(uploadResult.fileSize) & " bytes (" & numberFormat(uploadResult.fileSize / 1024, "0.00") & " KB)",
"mimeType": uploadResult.contentType & "/" & uploadResult.contentSubType,
"fileExtension": uploadResult.serverFileExt,
"uploadStatus": uploadResult.fileWasSaved ? "Saved Successfully" : "Upload Failed",
"serverPath": uploadResult.serverDirectory,
"uploadedAt": now(),
"fileExists": fileExists(uploadedFilePath)
};
</cfscript>
<h3>Upload Summary (User-Friendly View)</h3>
<cfdump
var="#uploadSummary#"
label="Quick Summary"
expand="yes">
<hr>
<!--- Display only the most important fields --->
<h3>Key Upload Details</h3>
<cfdump
var="#uploadResult#"
label="Essential Info"
show="clientFile,serverFile,fileSize,contentType,fileWasSaved"
expand="yes">
<!--- Log upload details to file --->
<cfif isDefined("url.logUpload")>
<cfset logFileName = "upload-log-" & dateFormat(now(), "yyyymmdd-HHMMSS") & ".html">
<cfdump
var="#uploadResult#"
output="#getTempDirectory()##logFileName#"
format="html"
label="File Upload Log - #uploadResult.clientFile#">
<p style="color: green;">Upload details logged to: #getTempDirectory()##logFileName#</p>
</cfif>
<!--- Validation example --->
<cfscript>
validationResults = {
"isValidSize": uploadResult.fileSize <= 5000000, // 5MB limit
"isValidType": listFindNoCase("jpg,jpeg,png,gif,pdf,doc,docx", uploadResult.serverFileExt),
"fileWasSaved": uploadResult.fileWasSaved,
"securityCheck": uploadResult.fileSize > 0
};
allValid = true;
for (key in validationResults) {
if (!validationResults[key]) {
allValid = false;
break;
}
}
</cfscript>
<h3>Validation Results</h3>
<cfdump
var="#validationResults#"
label="File Validation"
expand="yes">
<cfif allValid>
<p style="color: green; font-weight: bold;">✓ All validation checks passed!</p>
<cfelse>
<p style="color: red; font-weight: bold;">✗ Some validation checks failed!</p>
</cfif>
<p><a href="?">Upload Another File</a></p>
<cfcatch type="any">
<!--- Display error information --->
<h3 style="color: red;">✗ Upload Failed</h3>
<cfdump
var="#cfcatch#"
label="Error Details"
expand="yes"
show="message,detail,type,tagContext">
<p><a href="?">Try Again</a></p>
</cfcatch>
</cftry>
</cfif>
<!--- Display form data if available (useful for multi-part forms) --->
<cfif structKeyExists(form, "fileUpload") AND structCount(form) GT 1>
<h3>Additional Form Data</h3>
<cfdump
var="#form#"
label="Form Scope"
hide="fileUpload"
expand="yes">
</cfif>