有没有办法将Windows.Foundation.Diagnostics.LoggingSession保存为WinJS中的文本?

时间:2015-04-22 07:06:57

标签: logging windows-runtime winjs windows-error-reporting

我正在使用LogginSession来保存LogFiles并将其写入文件:

loggingChannel = new Windows.Foundation.Diagnostics.LoggingChannel("FlSMobileLogger");
LoggingSession = new Windows.Foundation.Diagnostics.LoggingSession("FLSMobileLog");
LoggingSession.addLoggingChannel(loggingChannel);

....

function enteredWhenLogEventOccurs(message) {

            var dateString = new Date().toJSON();
            var currentDate = dateString.substring(0, 4) + "-" + dateString.substring(5, 7) + "-" + dateString.substring(8, 10);
            var fileName = "log" + currentDate + ".log";

            loggingChannel.logMessage(message);
            LoggingSession.saveToFileAsync(WinJS.Application.local.folder, fileName);                     
        }

这些logsession保存为二进制.etl文件。 有没有办法将它们保存为文本或以任何方式转换它们?

提前致谢!

1 个答案:

答案 0 :(得分:1)

此命令可以将ETL文件转换为XML:

tracerpt.exe LogFile.etl -of XML -o LogFile.xml

您可以在此处找到完整的示例:

https://msdn.microsoft.com/en-us/library/windows/apps/windows.foundation.diagnostics.fileloggingsession