Record log while in programing

   new Thread(new Runnable() {
           @Override
           public void run() {
               File logFile = new File("/sdcard/logcat.txt");
               if(logFile.exists())
                   logFile.delete();
               try {
                   Process process = Runtime.getRuntime().exec("logcat -c");
//                    process = Runtime.getRuntime().exec("logcat -f " + logFile + " *:S MainActivity:D MyActivity2:D");
                   process = Runtime.getRuntime().exec("logcat -f " + logFile);
               } catch (IOException e) {
                   e.printStackTrace();
               }
           }
       }).start();








From:
http://www.journal.deviantdev.com/android-log-logcat-to-file-while-runtime/


logcat -f /sdcard/log.log -v time -s tag

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章