我想使用logcat为Android 5.0创建一个日志文件
我想为Android 5.0创建一个日志文件。我使用的logcat没有过滤器,但它只显示我的应用程序的日志,而不是所有的应用程序。它应该向我展示Android系统的完整日志我想使用logcat为Android 5.0创建一个日志文件,android,Android,我想为Android 5.0创建一个日志文件。我使用的logcat没有过滤器,但它只显示我的应用程序的日志,而不是所有的应用程序。它应该向我展示Android系统的完整日志 File root = new File(Environment.getExternalStorageDirectory(), "Logs"); // if external memory exists and folder with name Notes if (!root.exists()) {
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());
您可以下载SDK并使用adb logcat或从市场上获取aLogcat,这将直接在您的手机上显示日志 使用Android 4+时,只有当您有ROOT时,才能看到完整的系统日志。应用程序只能查看自己的日志消息。有关详细信息,请参阅