【问题标题】:How to implement Error Logging in Windows 8 METRO application?如何在 Windows 8 METRO 应用程序中实现错误记录?
【发布时间】:2014-04-30 17:11:02
【问题描述】:

您好,我正在开发一个 Windows 8 c#/xaml Metro 应用程序。

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

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

2) 是否有任何 3rd 方工具/免费库用于在 Metro 应用程序中记录错误。

3) 有哪些可用于错误记录的各种替代方法??

4) 错误记录的最佳做法是什么??

请帮帮我。

你的回答对我很有帮助。

提前致谢。

【问题讨论】:

    标签: windows-8 microsoft-metro winrt-xaml error-logging


    【解决方案1】:

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

    http://code.msdn.microsoft.com/windowsapps/LoggingSession-Sample-ccd52336 请参阅构建会话: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");
    

    【讨论】:

      【解决方案2】:

      Microsoft 提供了sample for logging,也许这会让您入门。

      this blog post 中,作者列举了一些在 Windows8 应用商店应用程序中设置登录的起点,以及自制的解决方案。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-04-03
        • 1970-01-01
        相关资源
        最近更新 更多