使用WPConnect从wp7获取脱机日志的命令?

时间:2012-12-12 09:10:07

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

我知道我们可以使用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

1 个答案:

答案 0 :(得分:0)