locked
see Metro Wwahost.exe console output without debugger

    Question

  • I'm trying to nail down a strange bug that only reproduces when the app is not under a debugger (even remote debugger). Is there a way to see console output for release app that runs outside of debugger?

    Being able to see events sent via msWriteProfilerMark would be great!

    Saturday, December 24, 2011 9:57 AM

Answers

  • One approach is to just map console.log etc. to msWriteProfilerMark. Then you can just view that in an ETW trace of the Microsoft-IE provider which you can capture using logman. Do you need it real time?

     

     

    (function () {
        if (window.console && window.console.log) {
            var originalLog = window.console.log;
            window.console.log = function (msg) {
                window.msWriteProfilerMark("Log: " + msg);
                originalLog(msg);
            }
        }
        if (window.console && window.console.info) {
            var originalInfo = window.console.info;
            window.console.info = function (msg) {
                window.msWriteProfilerMark("Info: " + msg);
                originalInfo(msg);
            }
        }
        if (window.console && window.console.warn) {
            var originalWarn = window.console.warn;
            window.console.warn = function (msg) {
                window.msWriteProfilerMark("Warn: " + msg);
                originalWarn(msg);
            }
        }
        if (window.console && window.console.error) {
            var originalError = window.console.error;
            window.console.error = function (msg) {
                window.msWriteProfilerMark("Error: " + msg);
                originalError(msg);
            }
        }
    })();
    
    Another approach is to store the messages then have a magic key sequence that will pop a div with the messages in.

    Saturday, December 24, 2011 6:41 PM