How to display long messages in logcat

If logcat is capping the length at 1000 then you can split the string you want to log with String.subString() and log it in pieces. For example:

int maxLogSize = 1000;
for(int i = 0; i <= veryLongString.length() / maxLogSize; i++) {
    int start = i * maxLogSize;
    int end = (i+1) * maxLogSize;
    end = end > veryLongString.length() ? veryLongString.length() : end;
    Log.v(TAG, veryLongString.substring(start, end));
}

Leave a Comment