Archive for December, 2011

Firefox for Android: Where’s the Error Console?

The new native Android UI version of Firefox does not ship with a dedicated Error Console. Instead, all console messages are redirected to the Android system log – also known as logcat. If you have the Android SDK installed, you already have a way to view the logcat:


# show the complete log
adb logcat

# show only Firefox log messages
adb logcat | grep "Gecko"

# show only Firefox error console messages
adb logcat | grep "GeckoConsole"

The Android stock browser also does the same thing. If you don’t have the Android SDK installed, you can install an Android app, like aLogCat, to scan the log instead.

Firefox for Android does support console API. You can use the API to send data to logcat from your web pages:


// Outputs a message. See also: info, warn, error, debug
console.log("value=", x);

// Outputs a simple call stack from where the call is executed
console.trace();

// Outputs results of a timer
console.time("my-timer");
console.timeEnd("my-timer");

Comments off