Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save Data of LogCat in android

Tags:

android

I want to save all the contents of log cat into specific file in Android. I used Eclipse IDE to develop the android application.

How i can achieve this ?

Thanks.

like image 233
Kartik Bhatt Avatar asked Jul 01 '11 12:07

Kartik Bhatt


2 Answers

Here is a way to get the Logcat contents progrmatically.

 Process process = Runtime.getRuntime().exec("logcat -d");

 BufferedReader bufferedReader = new BufferedReader(
     new InputStreamReader(process.getInputStream()));

 StringBuilder log=new StringBuilder();
 String line = "";
 while ((line = bufferedReader.readLine()) != null) {
     log.append(line);
 }

Check this link for more details.

like image 79
James Avatar answered Sep 20 '22 00:09

James


In the logcat tab, select all the lines. Then at the right top, click on the small triangle pointing down, called 'View Menu', and select 'Export Selection as text.."

like image 22
nhaarman Avatar answered Sep 23 '22 00:09

nhaarman