Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get complete system log from android

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?

like image 980
user9187 Avatar asked Nov 12 '22 01:11

user9187


1 Answers

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.

like image 69
Phillip Avatar answered Nov 27 '22 17:11

Phillip