Debugging XULRunner Applications

You will find a lot of information on MDC on Debugging a XULrunner Application.

Here is a little function that you can use to show the Error Console from within the application. You can assign this function to a memu command for ease of invoking the error console.

function showErrorConsole()
{
    var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'];
    var windowManagerInterface = windowManager.getService(Components.interfaces.nsIWindowMediator);
    var errorConsoleWindow = windowManagerInterface.getMostRecentWindow("global:console");

    if (errorConsoleWindow)
       errorConsoleWindow.focus();
    else
        window.open("chrome://global/content/console.xul", "_blank", 
                    "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
}

nsIConsoleService - How to log a messgae to the console with different error levels