1
votes

I am very new to ExtJS and still going through the Docs in Sencha site. I've seen a lot of examples in ExtJS4 using console.log() for debugging. However I couldn't figure out how to deal with console.log().

I am using Aptana Studio 3 for development, and I don't think Aptana can run console.log() (correct me if im wrong). So we need to debug it in Firebug? Then how to incorporate script files like ext-all.js, ext-debug.js into Firebug?

2
Be careful when using these as they will break IE if they are left in. If you are planning on deploying an application using ExtJS wrap all your console.log outputs like so //<debug> console.log('test'); //</debug> This way when you minify your app using Sencha SDK Tools you won't have to strip all the console.log entries manually to make IE workJamie Sutherland
Or include code like the following in your main app.js file: if (typeof console === "undefined") { console = { log: function () { }, info: function () { }, warn: function () { }, error: function () { } }; }JohnnyHK

2 Answers

5
votes

Right, the console.log() output from your scripts goes to the console window of the developer tools of whatever browser you're using (e.g. Firebug for Firefox). The browser developer tool picks up the script files from the same place the browser does; i.e. however you have them loaded into your web page.

1
votes

I would recommend you to use Google chrome. It has a very good developer tool. Apart from that for ExtJs, use ext-all-dev.js file instead of ext-all.js or ext-all-debug.js while doing any development. It will be really helpful. Check this link for more details.

Also you can set breakpoints by simply using the command debugger; in your javascript file. But to make this work make sure firebug/developer tool is running.

Hope this helps.