Reputation: 994
So I need to check some results in a Firefox add-on I'm working on, however the console.log() does not work. I've tried simply putting,console.log("Hello World");
in the main.js file and loading it, but it doesn't log anything.
Upvotes: 14
Views: 9941
Reputation: 41
You can use Firebug for your firefox extension development. If you install this add-on, you can use its console with "Firebug.Console.log();" command. Please be careful, in this command you should not type "Console" with a small letter!
In addition, you can use Firefox "Browser Console" (not Web Console) by the following command: Application.console.log();
Upvotes: 3
Reputation: 2668
Using the Addon SDK? You must set the Log level for your extension:
var self = require("sdk/self");
var prefService = require("sdk/preferences/service");
prefService.set('extensions.'+ self.id +'.sdk.console.logLevel','all');
Upvotes: 1
Reputation: 7741
If you are working on an extension/addon (not SDK), simply import the Console.jsm
and then the console.log()
will work normally. That is what I do.
Components.utils.import('resource://gre/modules/devtools/Console.jsm');
Update: As of Firefox 44+
Components.utils.import('resource://gre/modules/Console.jsm');
Upvotes: 8
Reputation: 33192
By default the minimum log level is error
. Everything else is not printed, and that includes console.log()
. Please see the Log Levels
for more information on how to use and configure logging and associated levels.
Upvotes: 17