Logger Plugin: How to trace messages to the debug Panel

One of the most useful plugins that ColdBox has to offer is the logger plugin. It has several functions and utilities that will make your development much much easier. You can see a full listing of this plugin's capabilities opening the Live API.

This example deals with how to trace messages to the ColdBox debug panel. You can see a screenshot of how this feature looks below:

As you can see from the screenshot, every tracer message gets display in order and with all the necessary information for you to trace messages. This plugin is very easy to use and the code below explains it all. Have fun using this great plugin and utility:

<!--- Create a tracer message --->
<cfset getPlugin("logger").tracer("Starting dspHello. Using default name")>

<cfscript>
getPlugin("logger").tracer("method called #mymethod#, arguments #arguments.toString()#);
</cfscript>

The last example is very useful, remember the Java core of Coldfusion. You can grab a complex variable and call its java toString() method to deflate the structure, array, etc. Very useful for logging purposes.

Persistance The tracing methods on ColdBox 2.5.0 can now persist tracer methods across relocations, until the debugging panel get's rendered. Very useful in ajax or post submittals.

Well, this is the end of this easy tutorial, hope you enjoyed it.


Copyright 2006 ColdBox Framework by Luis Majano