5

I want get complete system log. Currently, I'm using below code to get system log

try {
        final Process process = Runtime.getRuntime().exec("logcat -d -v threadtime *:I");
        final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
                process.getInputStream()));
        String line;
        while ((line = bufferedReader.readLine()) != null) {
            lineList.add(line);
        }
    } catch (final IOException e) {
        Log.e(e.toString());
    }

I'm able to get system log successfully using above code. It gives only last 30 min log. But, I want complete system log from my application launch. Is it possible to write system log to our private file?

user9187
  • 223
  • 4
  • 10

1 Answers1

1

To write continuously to a file, try this:

... exec( "logcat -f cachedirectory/logfile.txt -v threadtime" );

See the -f option in http://developer.android.com/tools/help/logcat.html.

Phillip
  • 5,366
  • 10
  • 43
  • 62