-1
String fileName = "somefile.txt";
File outputFile = new File(context.getDir("somedirectory", 0), fileName);
Runtime singleton = Runtime.getRuntime();
singleton.exec("logcat -v long"); //set the output format
singleton.exec("logcat -f " + outputFile.getAbsolutePath()); //format somehow reset to default here :/
이 코드는 파일을 만들고 그 안에 logcat을 저장하지만 형식을 long으로 변경할 수 없습니다. 나는 exec 함수가 두 개의 서로 다른 프로세스이고 그것들이 하나 일 필요가 있다고 믿는다. 그러나 나는 그것을 어떻게하는지 잘 모릅니다.logcat의 내용을 파일에 저장하고 logcat의 형식을 동시에 변경하려면 어떻게해야합니까?
왜이 질문은 downvoted 확실하지 답변을 제공하는 원본, 중복 등 – BrettG