2012-12-12 29 views
0

我知道我們可以使用WPConnect工具從WP7設備獲取離線日誌。但我已經忘記了這些命令,並且忘記了我從那裏學到的地址。有誰知道這些命令是什麼。我有以下代碼來記錄脫機例外,但我不知道如何檢索日誌文件..請幫助。使用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 

回答

0
+0

一旦記錄完成後,您實際上可以從設備或模擬器中獲取獨立的存儲文件並將其存儲在您的PC上。您需要使用WPConnect,然後使用come命令來獲取它...我已經完成它之前,但我已經忘記了命令! – Apoorva

+0

我得到了解決方案..我的問題是部分錯誤,我很快編輯它 – Apoorva