FUNCTION:TRACE
last edited by
gef
on 03-Oct-2011
trace
Description
A very new and interesting approach has been introduced in Railo 3.3 which is tracing objects. Sometimes it is necessary to know where a certain variable has been accessed or written. You can easily trace this by putting calling the trace() function with the object in question. Then a log file inside the standard log directory is written which writes all the read and write accesses to the object that has been traced.
Example:
<cfset test2={}> <cfset trace(var="test2",follow="true")> <cfset test2.a=1> <cfset test2.b=[]> <cfset test={}> <cftrace var="test" follow="true"> <cfset test.c=2> <cfset test.d=[]> <cfset dump(test)>
Usage Syntax
trace(struct caller,[string var,[string text,[string type,[string category,[boolean inline,[boolean abort,[boolean follow]]]]]]]): void
Return Information
| Return Type |
| void |
Arguments
The arguments for this function are set. You can not use other arguments except the following ones.
| Name | Type | Required | Description |
| caller | struct | Yes | |
| var | string | No | The name of a simple or complex variable to display. Useful for displaying a temporary value, or a value that does not display on any CFM page. |
| text | string | No | string, which can include simple variable, but not complex variables such as arrays. |
| type | string | No | Corresponds to the cflog type attribute: - Information - Warning - Error - Fatal Information |
| category | string | No | string name for identifying trace groups |
| inline | boolean | No | if true displays trace code in line on the page in the location of the trace function, addition to the debugging information output. |
| abort | boolean | No | stops further processing of the request. |
| follow | boolean | No | If true, Railo follows the variable defined in the [var] attribute and will log any changes to it. Ignored when attribute [var] is not defined. |
History
Railo 3.3: Introduced the function
SideBar
User Login