Download - Lucee writing your own debugging template
![Page 1: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/1.jpg)
Debugging templates DIY
Gert FranzRasia GmbH
![Page 2: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/2.jpg)
MY EVOLUTION
Assembler Basic Clipper Pascal Delphi Java CFML Lucee
![Page 3: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/3.jpg)
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
![Page 4: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/4.jpg)
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.
![Page 5: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/5.jpg)
![Page 6: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/6.jpg)
![Page 7: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/7.jpg)
Official definition:
Determines how to display debugging output
![Page 8: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/8.jpg)
DEBUGGING IN LUCEE
• Consists of 2.5 parts
• Enabling debugging
• Selecting the debugging template• Using the debugging logs
![Page 9: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/9.jpg)
OK SO LET'S HAVE A LOOK
![Page 10: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/10.jpg)
WHAT YOU END UP WITH:
![Page 11: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/11.jpg)
![Page 12: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/12.jpg)
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
![Page 13: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/13.jpg)
![Page 14: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/14.jpg)
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
![Page 15: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/15.jpg)
ARGUMENTS SCOPE OF FUNCTION OUTPUT
• Custom
• Debugging
• Context
![Page 16: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/16.jpg)
A CLOSER LOOK AT THE DEBUGGING ARGUMENT
• The debugging argument contains all important information collected througout a request:
![Page 17: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/17.jpg)
DATASOURCES
![Page 18: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/18.jpg)
ALL DUMPS WITH TARGET DEBUG• Great – this does not work ATM, I filed a ticket
that it is broken
![Page 19: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/19.jpg)
ALL EXCEPTIONS (SILENT OR NOT)
![Page 20: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/20.jpg)
HISTORY (CALLSTACK)
• The callstack tells us, in what order (by ID) the templates have been called
• This would allow us to display the callstack
![Page 21: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/21.jpg)
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
![Page 22: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/22.jpg)
PAGEPARTS
• This feature has been implemented for one of the upcomin tools which will tell you the slow parts in your application
![Page 23: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/23.jpg)
PAGES
![Page 24: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/24.jpg)
QUERIES
![Page 25: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/25.jpg)
TIMERS
• Mostly used for testing
• If you don't want your output to be disturbed by the timer output
• Generated by the tag CFTIMER
![Page 26: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/26.jpg)
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"
![Page 27: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/27.jpg)
ANY IDEAS FOR IMPORVEMENTS
• Make the layout nicer
• Toggle sections
• Group items
• Show percentages and heat maps
![Page 28: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/28.jpg)
ADDITIONAL IDEAS
• Callstack
• Session size information
• Filtering, either client or server side
![Page 29: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/29.jpg)
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
![Page 30: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/30.jpg)
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
![Page 31: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/31.jpg)
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 …
}
}
![Page 32: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/32.jpg)
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
![Page 33: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/33.jpg)
LET'S HAVE A LOOK
• I am creating several calls and then do a cfadmin action="surveillance"
• Let's inspect the code from there.
![Page 34: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/34.jpg)
BTW• I am working on a debugging console again
![Page 35: Lucee writing your own debugging template](https://reader031.vdocuments.us/reader031/viewer/2022022415/5a64b0e27f8b9a2c5d8b45f9/html5/thumbnails/35.jpg)
ANOTHER IMPORTANT BTW
CAPITOL CITY BREWERY
2 BLOCKS NORTH
2 BLOCKS EAST
6:00 PM