Umbraco debugging made easy

This post will show you how to debug umbraco macros, with the click of a browser button.

When you need to debug your macros, either xslt or usercontrols you do this by appending some text to the querystring on the page you need to debug.  The most important for me is ?umbDebugShowTrace=true it shows you the build in stack trace from the .NET framework. You can use this if your macro shows/throws an error, in the trace you can see exactly what went wrong in your xslt- or usercontrol macro. The other one is ?umbDebug=true which will show you what is injected into your macro.

For more information see the book debugging

Some screenshots from Internet Explorer and Firefox

Debugging in Internet Explorer

Debugging in Firefox

The trick is to make some favorite links in your browser containing javascript appending the debug querystring to the current page in browser. This is called bookmarklets.

Installing the debug buttons

 

Option 1: Install via right click in Internet Explorer
Make sure the "Links" is checked under View ? Toolbars ? Links.
Place the three favorites links in the favorite folder called Links.
Right click on this link: Umbraco Debug and choose "Add to favorites...".
Right click on this link: Umbraco Macro Info and choose "Add to favorites...".
Right click on this link: Umbraco Remove Debug and choose "Add to favorites...".

Option 2: Install via drag'n drop in Firefox
Make sure the "Bookmarks Toolbar" is checked under View ? Toolbars ? Bookmarks Toolbar.
Drag this link: Umbraco Debug up to your Bookmarks Toolbar.
Drag this link: Umbraco Macro Info up to your Bookmarks Toolbar.
Drag this link: Umbraco Remove Debug up to your Bookmarks Toolbar.

Are your buttons not visible after being installed?
Click here to see how to find them in Internet Explorer.
Click here to see how install them in Firefox via option 1

转自:http://www.cpalm.dk/blog/2008/01/20/umbraco-debugging-made-easy.aspx