如何在Windows 8 METRO应用程序中实现错误记录?
问题描述:
嗨,我正在开发一个Windows 8的c#/ xaml Metro应用程序。如何在Windows 8 METRO应用程序中实现错误记录?
我想在我的应用程序中实现错误日志记录。我想更好地处理错误日志。
1)如何才能登录错误信息(这样将有利于开发者纠正错误)
2)是否有任何第三方工具/免费图书馆在地铁应用程序错误日志。
3)什么是各种可供选择的错误记录?
4)错误记录的最佳实践是什么?
请帮我一把。
您的回答对我很有帮助。
在此先感谢。
答
对于Windows 8.1,您可以使用LoggingSession和LogginChannel的新Windows.Foundation.Diagnostics功能。
http://code.msdn.microsoft.com/windowsapps/LoggingSession-Sample-ccd52336 见BUILD-会议:http://channel9.msdn.com/Events/Build/2013/3-136
var channel = new LoggingChannel ("ChannelName");
var session = new LoggingSession("Session Name");
session.AddLoggingChannel(channel, LoggingLevel.Warning);
channel.LogMessage("Message to log", LoggingLevel.Error);
channel.LogValuePair("Count", 42, LoggingLevel.Error);
//when error detected, save the log session to disk
var logFile = await session.SaveToFileAsync(ApplicationData.Current.LocalFolder, "CrashLog");