From GreaseSpot Wiki
Jump to: navigation, search

This feature is deprecated. Script authors are advised to use console logging instead.


This method provides a very simple logging facility. If you aren't seeing your messages, make sure you navigate to about:config, and change the values of javascript.options.showInConsole and javascript.options.strict to true.

The output is displayed in the error console, and includes the namespace and name of the script before and the provided string value. So, this script:

// ==UserScript==
// @name          GM_log Example
// @namespace
// ==/UserScript==

GM_log("This is an example of GM_log");

Will produce a line in the error console like: Example: This is an example of GM_log

Compatibility: Greasemonkey 0.3b+


function GM_log( message )


String (or any object with a .toString() method) The message to display in the console.




GM_log("Hello, World!");
GM_log("Warning, " + someInputField.value + "!");

GM_log and Firebug

Since Firebug 1.0, extensions.firebug.showChromeMessages must be set to true for GM_log messages to show up in the Firebug console.

It is also recommended to enable extensions.firebug.showChromeErrors, as doing so will reveal syntax errors and script breaks. This can be done from about:config, or from the Firebug GUI. Go to the "Console" tab, then click the arrow next to the tab's name, and ensure that "Show Chrome Errors" and "Show Chrome Messages" are checked.

However, since GM_log will only display a single string at a time, users with Firebug installed may prefer to use console.log instead.