loggingfirefoxconsolefirefox-addon

Console logging from a Firefox add-on


The Mozilla documentation (https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/console.html) says that I should use console.log to generate messages from an extension. Those messages are said to appear in the Firefox Error Console. But this is not the case for me. I'm using the Addon builder for the first time today, and I'd like to create an extension that switches tabs on certain events. The tabs are indeed switched, and to a tab which I expected, so my code definitely runs. But the console.log output is nowhere to see.

I have set the filter to "All". All I see are CSS warnings from the addon builder itself.

I have also installed Firebug. It doesn't show anything, too. (This works fine when using console.log from the context of a web page though.) The problem with Firebug would be that it's only enabled for one/some tab anyway, so when switching tabs, it's useless. I need a log window that's always there.

So where will the output from console.log end up?


Solution

  • Go ahead and put a test console.log("something") in your addon main();

    If nothing shows up in the Error Console ('Messages' tab), then maybe Firefox isn't configured to show console.log (happened recently with jetpack sdk 1.14). See: Changes to console.log behaviour in SDK 1.14 for details.

    Quick and dirty summary: In about:config set extensions.sdk.console.logLevel to "all"

    Although from your question:

    I have set the filter to "All".

    ... it sounded like your were already aware of this. So it's not entirely clear what you meant by that.