【问题标题】:Commands to get offline logs from wp7 using WPConnect?使用 WPConnect 从 wp7 获取离线日志的命令?
【发布时间】:2012-12-12 09:10:07
【问题描述】:

我知道我们可以使用 WPConnect 工具从 WP7 设备获取离线日志。但是我忘记了命令,也忘记了我学习它的站点地址。有谁知道这些命令是什么。我有以下代码来记录离线异常,但我不知道如何检索日志文件。请帮忙。

  #region Offline Error Logger
    /// <summary>
    /// Logs Exception for the app when the device is not connected to the PC.This file can later be retrieved for the purpose of Bug fixing 
    /// </summary>
    /// <param name="strMsg">Exception message</param>
    private static void LogOffline(string strMsg)
    {

如果 LOG_ENABLED

        try
        {
            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                string dirName = "SOSLog";
                string logFileName = "SOSLog.txt";
                string fullLogFileName = System.IO.Path.Combine(dirName, logFileName);
                // TODO: Synchronize this method with MainPage using Mutex
                string directoryName = System.IO.Path.GetDirectoryName(fullLogFileName);
                if (!string.IsNullOrEmpty(directoryName) && !myIsolatedStorage.DirectoryExists(directoryName))
                {
                    myIsolatedStorage.CreateDirectory(directoryName);
                    Debug.WriteLine("Created directory");
                }
                if (myIsolatedStorage.FileExists(fullLogFileName))
                {
                    using (IsolatedStorageFileStream fileStream =
                            myIsolatedStorage.OpenFile(fullLogFileName, FileMode.Append, FileAccess.Write))
                    {
                        using (StreamWriter writer = new StreamWriter(fileStream))
                        {
                            writer.WriteLine(strMsg);
                            writer.Close();
                        }
                    }
                }
                else
                {
                    using (IsolatedStorageFileStream fileStream =
                            myIsolatedStorage.OpenFile(fullLogFileName, FileMode.Create, FileAccess.Write))
                    {
                        using (StreamWriter writer = new StreamWriter(fileStream))
                        {
                            writer.WriteLine(strMsg);
                            writer.Close();
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine("Exception while logging: " + ex.StackTrace);
        }

endif

    }
    #endregion

【问题讨论】:

    标签: windows-phone-7 windows-phone-7.1 error-logging


    【解决方案1】:

    【讨论】:

    • 日志记录完成后,您实际上可以从设备或模拟器中获取隔离的存储文件并将其存储在您的 PC 上。您需要使用 WPConnect,然后使用命令来获取它。 ..我以前做过,但是我忘记了命令!!!
    • 我得到了解决方案..我的问题部分错误,很快就会编辑它
    猜你喜欢
    • 2021-12-09
    • 2016-04-20
    • 2021-09-30
    • 2022-12-03
    • 1970-01-01
    • 1970-01-01
    • 2016-05-07
    • 2019-08-12
    • 1970-01-01
    相关资源
    最近更新 更多