ColdFusion provides a set of JavaScript functions that log information to a pop-up display window. ColdFusion also logs many standard client-side activities to the window.
Display logging information
To display the logging window you must do the following:
- Enable ColdFusion to send information to the logging window
- Request logging window information in the main CFML page request.
Enable logging output
To enable ColdFusion to send information to the logging window, do the following:
- Select the Enable Ajax Debug Log Window option on the ColdFusion Administrator > Debugging & Logging > Debug Output Settings page. To view exception messages in the logging window, select the Enable Robust Exception Information option on the Debug Output Settings page.
- Make sure that the IP address of the system where you do the debugging is included on the ColdFusion Administrator > Debugging & Logging > Debugging IP List page of the ColdFusion Administrator. By default this list includes only 127.0.0.1.
Display logging information for a page
To display the logging window when you request a CFML page in the browser, specify an HTTP parameter of cfdebug in the URL when you request a page, as in the following URL:
http://localhost:8500/myStore/products.cfm?cfdebug |
After the debug log window appears, it continues running until you navigate to a new page in the browser. The logging window includes options that let you filter the messages by either or both of the following criteria:
- Severity
- Category
You can select to display logging information at any combination of four levels of severity: debug, info, error, and window. The specific logging function that you call determines the severity level.
The logging window always displays options to filter the output by using standard categories: bind, global, http, LogReader, and widget. (For information on these categories, see Standard ColdFusion logging messages below.) It also displays a filter option for each custom category that you specify in a ColdFusion logging call. ColdFusion does not limit the number of categories you create, but create only as many categories as you require to debug your application effectively.
Logging information
You call the following JavaScript functions to send information to the logger. In most cases, the function corresponds to a severity level, as follows:
Function |
Severity |
Purpose |
---|---|---|
debug |
A message that aids in debugging problems. |
|
debug |
A representation of a single variable in a format similar to cfdump. This function displays the structure and contents of JavaScript Array and Object variables. |
|
error |
Information about an error. Use this function only in error-handling code. |
|
info |
Information about properly operating code that is useful in tracing and analyzing the client-side code's execution. |
You cannot generate a window-level message. This level is reserved for messages generated by the log reader window, including information about JavaScript errors in the log function calls.
When you call a logging function, you specify a message and a category.
- The message can include JavaScript variables and HTML markup, such as bold text and line breaks.
- The category is a short descriptive name. ColdFusion generates a check box option for each category to filter the logging window output. This parameter is optional; the default value is global. You can specify a standard ColdFusion category or a custom category.
To log information for a page, you must have a ColdFusion Ajax tag on the page, or use the cfajaximport tag. The cfajaximport tag does not require any attributes to enable logging.
The following logging function generates an error level, Pod A category log message:
ColdFusion.Log.error("<b>Invalid value:</b><br>" + arg.A, "Pod A"); |
Standard ColdFusion logging messages
ColdFusion automatically logs messages in the following categories:
Category |
Description |
---|---|
global |
(the default) Messages that are not logged from within the ColdFusion Ajax libraries, for example, initialization of the logging infrastructure. |
http |
Information about HTTP calls and their responses, including the contents of HTTP requests and information on CFC invocations and responses. |
LogReader |
Messages about the log display window. |
bind |
Bind-related actions such as evaluating a bind expression. |
widget |
Control-specific actions such as tree and grid creation.
|