如何在Windows 8 METRO应用程序中实现错误记录? [英] How to implement Error Logging in Windows 8 METRO application?

查看:111
本文介绍了如何在Windows 8 METRO应用程序中实现错误记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Windows 8 c#/xaml Metro应用程序.

Hi i am developing an windows 8 c#/xaml Metro application.

我想在我的应用程序中实现错误记录.我想以更好的方式处理错误日志.

i want to implement error logging in my app. I want to handle error logs in better way.

1)如何记录错误信息(以便于开发人员纠正错误)

1) How can log the error information(so that it will be helpful for the developer to rectify the error)

2)是否有任何第三方工具/免费库可用于在Metro应用中记录错误.

2)Are there any 3rd party tools / free library's for error logging in metro apps.

3)错误日志记录有哪些可用的替代方法?

3)What are the various alternatives available for error logging ??

4)错误记录的最佳实践是什么?

4)What is the best followed practice for error logging ??

请帮帮我.

您的答案将对我非常有帮助.

Your answer will be very helpful to me.

谢谢.

推荐答案

对于Windows 8.1,您可以使用LoggingSession和LogginChannel的新Windows.Foundation.Diagnostics功能.

For Windows 8.1 you can use the new Windows.Foundation.Diagnostics functionality of LoggingSession and LogginChannel.

http://code.msdn.microsoft.com/windowsapps/LoggingSession-样品-ccd52336 请参阅BUILD会话: http://channel9.msdn.com/Events/Build/2013/3-136

http://code.msdn.microsoft.com/windowsapps/LoggingSession-Sample-ccd52336 See BUILD-session: 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");

这篇关于如何在Windows 8 METRO应用程序中实现错误记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆