Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mManishTrivedi/23f3626ab3c5384d131366b726de0f35 to your computer and use it in GitHub Desktop.
Save mManishTrivedi/23f3626ab3c5384d131366b726de0f35 to your computer and use it in GitHub Desktop.
if log message length over than 4000 char
if (sb.length() > 4000) {
Log.v(TAG, "sb.length = " + sb.length());
int chunkCount = sb.length() / 4000; // integer division
for (int i = 0; i <= chunkCount; i++) {
int max = 4000 * (i + 1);
if (max >= sb.length()) {
Log.v(TAG, "chunk " + i + " of " + chunkCount + ":" + sb.substring(4000 * i));
} else {
Log.v(TAG, "chunk " + i + " of " + chunkCount + ":" + sb.substring(4000 * i, max));
}
}
}
// http://stackoverflow.com/questions/8888654/android-set-max-length-of-logcat-messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment