Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox Addon console.log() Not working

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.

like image 370
Knight Yoshi Avatar asked Oct 23 '13 02:10

Knight Yoshi


People also ask

How do I open the console log in Firefox?

You can open the Browser Console in one of two ways: from the menu: select “Browser Console” from the Browser Tools 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).

What is Firefox Web console?

The Web Console:Logs information associated with a web page: network requests, JavaScript, CSS, security errors and warnings as well as error, warning and informational messages explicitly logged by JavaScript code running in the page context.


2 Answers

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.

like image 176
nmaier Avatar answered Sep 27 '22 21:09

nmaier


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');
like image 20
erosman Avatar answered Sep 27 '22 23:09

erosman