Forked from kiirpi/log_chunk_length_over_4000_char.java
Created
October 14, 2022 06:00
-
-
Save mManishTrivedi/23f3626ab3c5384d131366b726de0f35 to your computer and use it in GitHub Desktop.
if log message length over than 4000 char
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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