Upload
gert-franz
View
99
Download
0
Embed Size (px)
Citation preview
Debugging templates DIY
Gert FranzRasia GmbH
MY EVOLUTION
Assembler Basic Clipper Pascal Delphi Java CFML Lucee
WHO AM I?
• Gert Franz– Involved with Lucee and Railo since day 1
– Into CFML for 17 years
– DBA, System architect
– CTO Rasia Ltd, CTO Rasia CH
• Rasia is founding Member of the Lucee association
WHO AM I?
• Studied Astrophysics in München
• Basic, dBase, Clipper, Visual Basic, Delphi, Java
• Performance, DB & Code Tuning is my professional Hobby
• I live in Switzerland
• Lucee training, consulting, support etc.
Official definition:
Determines how to display debugging output
DEBUGGING IN LUCEE
• Consists of 2.5 parts
• Enabling debugging
• Selecting the debugging template• Using the debugging logs
OK SO LET'S HAVE A LOOK
WHAT YOU END UP WITH:
TEMPLATES? WHAT? WHERE?
• A debugging template in Lucee is:
– A cfc located in a specific folder
– Containing a body needed for configuration
– Containing a method called "output" which handles the display of the data
LET'S INSPECT THE CLASSIC.CFC TEMPLATE
• Content of the body of the CFC
– Is not necessary for execution
– Only cofiguration
• Output method
• Arguments of the output method
ARGUMENTS SCOPE OF FUNCTION OUTPUT
• Custom
• Debugging
• Context
A CLOSER LOOK AT THE DEBUGGING ARGUMENT
• The debugging argument contains all important information collected througout a request:
DATASOURCES
ALL DUMPS WITH TARGET DEBUG• Great – this does not work ATM, I filed a ticket
that it is broken
ALL EXCEPTIONS (SILENT OR NOT)
HISTORY (CALLSTACK)
• The callstack tells us, in what order (by ID) the templates have been called
• This would allow us to display the callstack
IMPLICIT ACCESS
• In this section you get all the variables, that are called by following the rules of scope cascading. If you see none, two reasons:– Feature is disabled
– Your programming is impecable
PAGEPARTS
• This feature has been implemented for one of the upcomin tools which will tell you the slow parts in your application
PAGES
QUERIES
TIMERS
• Mostly used for testing
• If you don't want your output to be disturbed by the timer output
• Generated by the tag CFTIMER
TRACES
• If you want to follow a variables state througout the request, you can use the tag CFTRACE
• It is kind of like a dump output="debug"
ANY IDEAS FOR IMPORVEMENTS
• Make the layout nicer
• Toggle sections
• Group items
• Show percentages and heat maps
ADDITIONAL IDEAS
• Callstack
• Session size information
• Filtering, either client or server side
SO HOW DO WE WRITE OUR OWN?
• Simple. Create a CFC– Where?
• Server side:– server-config-dir/context/context/admin/debug
• Webcontext side– web-context-dir/context/admin/debug
SO HOW DO WE WRITE OUR OWN?
• Name the CFC individually so that it does not get overwritten
• Add a body and one method like follows
SO HOW DO WE WRITE OUR OWN?
component extends="Debug" output="no"
fields=array(
group("Execution Time","Execution times for templates",3),
field("Min Exec Time","minimal","0",true,{_appendix:"micros",_bottom:"Exec time templates"},"text40"),
field("Highlight","highlight","250000",true,{_appendix:"micros",_bottom:"Highlight "},"text50"),
);
string function getLabel(){}
string function getDescription(){}
string function getid(){}
void function onBeforeUpdate(struct custom){ }
void function output(required struct custom, required struct debugging, string context="web") {
… here comes the output …
}
}
CFADMIN ACTION="SURVEILLANCE"
• This is a very interesting tag that allows you to see what's going on on your server
• It also contains the debugging information generated up to that time
LET'S HAVE A LOOK
• I am creating several calls and then do a cfadmin action="surveillance"
• Let's inspect the code from there.
BTW• I am working on a debugging console again
ANOTHER IMPORTANT BTW
CAPITOL CITY BREWERY
2 BLOCKS NORTH
2 BLOCKS EAST
6:00 PM