0

I am getting a response from server in json format and it have more then 5000 lines. My problem is that I am not able to see complete json value in logcat and I already increase buffer size from eclipse logcat. I can not use this url in PC's web browser to check the json value because it's using some tokens to identify device. I have only one solution that I have to write a file with this json value and than extract it to my PC.

Anyone know some good solutions please help me.

ParikshitSinghTomar
  • 417
  • 1
  • 4
  • 28

1 Answers1

0

You can split your lengthy response and print it like this:

int maxLogSize = 1000;
for(int i = 0; i <= veryLongString.length() / maxLogSize; i++) {
  int start = i * maxLogSize;
  int end = (i+1) * maxLogSize;
  end = end > veryLongString.length() ? veryLongString.length() : end;
  Log.v(TAG, veryLongString.substring(start, end));
}
amalBit
  • 12,041
  • 6
  • 77
  • 94
  • thanks @amalBit, but I want to know a way which can resolve my issue in standard way provided by eclipse/android. – ParikshitSinghTomar Jan 02 '15 at 07:56
  • do you that how i can write this log into a file which will be saved in my PC.I already know how to write a file which will saved in mobile device but there are more effort to export this file into PC. If you know please give me solution. – ParikshitSinghTomar Jan 02 '15 at 07:58
  • There is no default way to do this. Its the limit given by the logcat.. You can only have work arounds.. This is a much simpler way than to save to a file and retrieve it. – amalBit Jan 02 '15 at 10:20
  • but its also take more effort to format my json structure. If I use above solution than in each message I have some extra values and I have to delete these extra text from message and create required message and then format my JSON value. – ParikshitSinghTomar Jan 05 '15 at 06:33