2016-11-19 105 views
-1

我想爲Android 5.0創建一個日誌文件。我使用的是沒有過濾器的logcat,它仍然只顯示我的應用程序的日誌而不是所有的應用程序。它應該顯示我Android系統的完整日誌。我想使用logcat爲Android 5.0創建日誌文件

File root = new File(Environment.getExternalStorageDirectory(), "Logs"); 
    // if external memory exists and folder with name Notes 
    if (!root.exists()) { 
     root.mkdirs(); // this will create folder. 
    } 
    file = new File(root, "log.txt"); // file path to save 
Process process = Runtime.getRuntime().exec("logcat -f "+file.getAbsolutePath()); 

回答