Debugging Dojo Applications

When you try to debug your JavaScript sources of your Dojo Toolkit webapp / website using Firebug, you will realize soon that it’s quite not possible.
Error reports are linked to framework JavaScript files but do not point you to the location where the error actually occurs.
Step debugging is not possible, too. The only thing you can do is to add log statements in your code, which isn’t a very productive debugging approach.

Fortunately, there is a switch to turn on the ability to debug your application.
When you load the Dojo library …

<script type="text/javascript" src="dojo/dojo.js" djConfig="parseOnLoad: true" />

… simply add debugAtAllCosts: true to the djConfig attribute to make debugging work:

<script type="text/javascript" src="dojo/dojo.js" djConfig="parseOnLoad: true, debugAtAllCosts: true" />

debugAtAllCosts will significantly slow down your application, so it is important to disable it when you deploy your application to a production environment.

Short URL for this post:
This entry was posted in Java Web Frameworks and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *