Home

 

Logging

Dojo provides a mechanism for logging in the application. To log certain events:

Include the isDebug configuration parameter (Example | 9-13).

Example 19-13 JavaScript function dojo.js for logging

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

When the isDebug flag is true, we can log the application execution using the console.log call (Example | 9-14).

Example 19-14 JavaScript code for logging (in fillAccountGrid function)

			for(i=0;i<account.length;i++){
				console.log(account[i]);
				accountData.push([account[i].id,account[i].balance]);
			}

The result of a logging call appears in the browser at the bottom as {002-222001}, and when clicked shows the details:
transactCollection : {}
id : 002-222001
customerCollection : {}
balance : 65484.23

To disable the log, just change isDebug: false.
ibm.com/redbooks