View

Thursday 17 May 2012

How to use Logcat Backup file in SD card

I used sample application to Backup the Logcat file in SD card.First it create the Sample_log_file.txt in the SD card Location and then we give  write to read the logcat file command like -d -f

The following code is
try {
          File filename = new File(Environment.getExternalStorageDirectory()+"/Sample_log_file.txt");
          filename.createNewFile();
          String cmd = "logcat -d -f "+filename.getAbsolutePath();
          Runtime.getRuntime().exec(cmd);
       } catch (IOException e) {
          e.printStackTrace();
        }
You must give the permission in AndroidManifest.xml
 <uses-permission android:name="android.permission.READ_LOGS"/>
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Go and check the file in DDMS->open File Explorer->open Mnt(management)->SD Card->sample_log_file.txt
  



             /    **Log file shown in the word**/



4 comments:

  1. Catch up with the most reliable development trends and find solutions to the issues that may arise.
    Best technology to learn
    Best technology blogs
    Online graphic designing courses
    tech blogspot

    ReplyDelete
  2. "I visited your blog you have shared amazing information, i really like the information provided by you, You have done a great work. I hope you will share some more information regarding full movies online. I appreciate your work.
    Thanks"

    Medium Bloglovin Mystrikingly Justpaste Mystrikingly Medium

    ReplyDelete