When I want to output enough debugging information in Logcat today, we find that the information returned from Logcat is obviously less in the following section.
Feel a bit strange, thought is the code problem, looked for a bit, found not;
So guge. The original logcat on the implementation of the memory allocation for the message is about 4k. So the content is discarded directly;
Not output;
Also found that logcat for "\ n" line break automatically as a symbol is automatically separated into multiple log output, but you log.d (null, "There are multiple \ n more than 4k length characters");
This kind of information, although how many will produce the number of log, but you pass to this message the most accept is about 4k, the back not, and then in accordance with the principle of "cut";
So, think about it, write a debug class yourself to slice more than 4k of the message to use multiple LOG.D output;
The simple implementation is as follows:
Package Com.qidizi.softkeyboard;import Android.util.log;class Debug {//Use log to display debug information because log has a 4k character length limit per message on implementation// So here you use your own section to output a messagepublic static void show (String str) {str = Str.trim (); int index = 0;int maxLength = 4000; String Sub;while (Index < Str.length ()) {//Java characters are not allowed to specify more than the total length of endif (Str.length () <= index + maxLength) {sub = Str.s Ubstring (index);} else {sub = str.substring (index, maxLength);} Index + = maxLength; LOG.I ("Qidizi_debug", Sub.trim ());}}}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android's Logcat message has a character-length limit that will be truncated directly