3

What is the best way to print XML-string to the Logcat window? The string I am trying to print out is a actually a StringWriter which contain a lot of data, when I try to print it out the Logcat truncates it and does not print out the whole content (it at least seems like it does not). When I try to print out the length of the StringWriter (StringWriter.toString().length()) it turns out to be 500, but as far as I can see the XML-content is longer than that. Is the StringWriter limited to a length of 500? Or are there anyway I can get Logcat to stop truncating the string and print out the whole content instead?

Araw
  • 2,410
  • 3
  • 29
  • 57
  • I think it is limited, just break the string down to 500 characters each and print it out, I don't think there is really an other way. – Ahmad Oct 03 '12 at 20:15
  • 1
    What's the idea behind sending it to logcat instead of for instance, saving it to the SDCard as a text file you could easily access later with all the added benefits of being able to format it/search it using your favourite editor such as Notepad++? – Vincent Mimoun-Prat Oct 03 '12 at 20:21
  • 1
    Check if this helps:http://stackoverflow.com/a/5436686/801437 Something related to debug perspective. – Vishal Vyas Oct 03 '12 at 20:30
  • @MarvinLabs : Seemed easier to just print it to the logcat window. But writing to a file may be the way to go. – Araw Oct 03 '12 at 20:41
  • @Araw Try this it's work for me http://stackoverflow.com/a/7606118/5488468 – Bipin Bharti Apr 21 '17 at 05:37

0 Answers0