lucee writing your own debugging template

35
Debugging templates DIY Gert Franz Rasia GmbH

Upload: gert-franz

Post on 21-Jan-2018

97 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: Lucee   writing your own debugging template

Debugging templates DIY

Gert FranzRasia GmbH

Page 2: Lucee   writing your own debugging template

MY EVOLUTION

Assembler Basic Clipper Pascal Delphi Java CFML Lucee

Page 3: Lucee   writing your own debugging template

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

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
Page 6: Lucee   writing your own debugging template
Page 7: Lucee   writing your own debugging template

Official definition:

Determines how to display debugging output

Page 8: Lucee   writing your own debugging template

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

OK SO LET'S HAVE A LOOK

Page 10: Lucee   writing your own debugging template

WHAT YOU END UP WITH:

Page 11: Lucee   writing your own debugging template
Page 12: Lucee   writing your own debugging template

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
Page 14: Lucee   writing your own debugging template

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

ARGUMENTS SCOPE OF FUNCTION OUTPUT

• Custom

• Debugging

• Context

Page 16: Lucee   writing your own debugging template

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

DATASOURCES

Page 18: Lucee   writing your own debugging template

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

ALL EXCEPTIONS (SILENT OR NOT)

Page 20: Lucee   writing your own debugging template

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

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

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

PAGES

Page 24: Lucee   writing your own debugging template

QUERIES

Page 25: Lucee   writing your own debugging template

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

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

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

ADDITIONAL IDEAS

• Callstack

• Session size information

• Filtering, either client or server side

Page 29: Lucee   writing your own debugging template

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

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

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

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

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

BTW• I am working on a debugging console again

Page 35: Lucee   writing your own debugging template

ANOTHER IMPORTANT BTW

CAPITOL CITY BREWERY

2 BLOCKS NORTH

2 BLOCKS EAST

6:00 PM