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?
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?
Share Improve this question edited Oct 27, 2014 at 18:16 abatishchev 100k88 gold badges301 silver badges442 bronze badges asked Jul 3, 2012 at 15:23 sozhensozhen 7,67714 gold badges38 silver badges53 bronze badges 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 work – Jamie Sutherland Commented Jul 3, 2012 at 15:56
-
1
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 Commented Jul 3, 2012 at 16:16
2 Answers
Reset to default 5Right, 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.
I would remend 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 mand debugger;
in your javascript file.
But to make this work make sure firebug/developer tool is running.
Hope this helps.