close

  
<p> Debugging in *Acre*
===================

The most important debugging tool that Acre provide is the `console`, which can be activated either by clicking the `view with console` button at the top right of the app editor, or by simply appending the `acre.console=1` parameter to any of your app URL. 

The `console` view provides _under the hood_ access to the server side process that executed your application script.

Acre logs some information to the console by default but it's designed to be quiet by design, but by using the `console.*` API you can write to it. This is very similar to how you would do it on the client side by using the `console.*` APIs in [FireBug](http://www.getfirebug.com/ "Get FireBug").

You can pass javascript objects directly to the acre console which it will then show them to you as expandable trees (this includes objects returned by `acre.urlfetch` or `acre.freebase.mqlread` which could be very useful to understand what JSON-speaking web services return to you without).

For example, try:

&gt;      var a = {
&gt;        "a" : 1,
&gt;        "b" : {
&gt;          "b" : 2
&gt;        }
&gt;      };
&gt;      console.log(a);

or even 

&gt;      console.log(acre.urlfetch("http://www.google.com/"));

Note that you can use the same `console.*` APIs even in your template files, just remember to wrap them inside the `</p>

Comments

Hide