Since we are using logcat as a console for android. There are cases when the the output text/msg is kinda big and I can't see the complete output. The log cat shows only the starting part of it. Is there a way to expand it so that I can see the full msg?
-
1yeah.. I usually copy it to a text editor from DDMS – Samuh Jan 04 '10 at 08:42
-
I think that's the only way out – Bohemian Jan 04 '10 at 09:01
-
1But u can't copy the whole text till the end if its large. The msg gets stripped @ the end. – Bohemian Jan 04 '10 at 09:53
-
You will get LogCat outputs from your Eclipse options, right ? – Sumit M Asok Jan 04 '10 at 18:00
-
1Go to Window->Show View->Other->Android->LogCat. And to show logs use Log.v("tag","msg"); – Bohemian Jan 05 '10 at 05:14
5 Answers
This is the way I solved the problem. Hope it helps.
The important method for using it inside your code is splitAndLog.
public class Utils {
/**
* Divides a string into chunks of a given character size.
*
* @param text String text to be sliced
* @param sliceSize int Number of characters
* @return ArrayList<String> Chunks of strings
*/
public static ArrayList<String> splitString(String text, int sliceSize) {
ArrayList<String> textList = new ArrayList<String>();
String aux;
int left = -1, right = 0;
int charsLeft = text.length();
while (charsLeft != 0) {
left = right;
if (charsLeft >= sliceSize) {
right += sliceSize;
charsLeft -= sliceSize;
}
else {
right = text.length();
aux = text.substring(left, right);
charsLeft = 0;
}
aux = text.substring(left, right);
textList.add(aux);
}
return textList;
}
/**
* Divides a string into chunks.
*
* @param text String text to be sliced
* @return ArrayList<String>
*/
public static ArrayList<String> splitString(String text) {
return splitString(text, 80);
}
/**
* Divides the string into chunks for displaying them
* into the Eclipse's LogCat.
*
* @param text The text to be split and shown in LogCat
* @param tag The tag in which it will be shown.
*/
public static void splitAndLog(String tag, String text) {
ArrayList<String> messageList = Utils.splitString(text);
for (String message : messageList) {
Log.d(tag, message);
}
}
}

- 3,026
- 4
- 26
- 25
I never use the GUI to view logcat output, so I'm not sure where/whether there are scrollbars in the DDMS/Eclipse UI.
Anyway, you can use logcat from the command line — there are loads of options.
To watch the log of an active device continually: adb logcat
To dump the whole log: adb logcat -d
To dump the whole log to a file: adb logcat -d > log.txt
To filter and display a particular log tag: adb logcat -s MyLogTag
...and much more!

- 110,418
- 27
- 198
- 193
-
3I don't see how this would help anyone, yet has a lot of votes. The [logcat messages are truncated on the device](http://stackoverflow.com/a/8899735/253468), so even if you read the via console, you're reading the truncated text. Is there an option hidden in "...and much more!" you're not telling about? – TWiStErRob Sep 10 '16 at 09:19
If you want to write long messages to see in logcat
it may be worth writing your own wrapper around the android.util.Log
methods which splits your long message over multiple lines.

- 190,537
- 57
- 313
- 299
-
-
1@OneWorld - Yes, call Log.v a number of times passing it different parts of the message. – David Webb Oct 28 '10 at 16:18
Of course, you can change the column width, just by going to the end of the line clicking and dragging. That is a pain for really long messages. If I have a really long message, I generally copy the line and paste it into a text file. Ctrl-C in Windows will copy it.

- 10,282
- 14
- 53
- 75
-
2Logcat strips off text from the end if the msg is long. It doesn't logs the full msg. So when I copy it the text also comes stripped – Bohemian Jan 05 '10 at 05:12
To add to Jay Askren's answer, you can also double-click on the right-edge of the "text" column header to expand it fully. I've noticed that even so there's a limit to the number of chars Eclipse will display.

- 7,562
- 10
- 53
- 78