I understand that I can log to the console when using a Firefox extension with the cfx run
command.
Is there a way to log to a console after the extension has been packaged with cfx xpi
? Logging to Firebug is fine if possible.
I have found two blog posts about this (here and here). Both are rather old and don't work any more.
I'm using version 1.10 of the add-on SDK and FF15.
You can open the Browser Console in one of two ways: from the menu: select “Browser Console” from the Web Developer submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on macOS). from the keyboard: press Ctrl + Shift + J (or Cmd + Shift + J on a Mac).
in the Firefox menu (or Tools menu if you display the menu bar or are on macOS), click Web Developer then Debugger. press Ctrl + Shift + i ( Command + Option + i on macOS) and click Debugger.
You need to do 2 things:
• in about:config, add a new option extensions.sdk.console.logLevel
and give it the value "all"
• restart Firefox
• Tools -> Web developer -> Browser console
• NOTE: this is different from the usual Web Console used to debug web pages
You should see addons logs there now.
TLDR:
about:config
url and create key extensions.sdk.console.logLevel
with value all
cfx
or its successor jpm
creates this configuration key automatically in development firefox profile.
From logging documentation:
extensions.sdk.console.logLevel
: if set, this determines the logging level for all installed SDK-based add-ons.
extensions.extensionID.sdk.console.logLevel
, where extensionID is an add-on's Program ID. If set, this determines the logging level for the specified add-on. This overrides the global preference if both preferences are set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With