Console.log truncates my debug `…}`

I’m using developer console log to see all my debug logs but it cuts off my log after 1920 characters

How do I fix that? and even I have tried download the log and open in a notepad++ but still I see the cut off

CurrencyIsoCode=USD}), ...} <<<<<

Answer

This is a feature (although in this case you may not view it as such, understandably) of the built in toString on apex collection types. The idea being that since the debug log has a maximum size debugging a single large collection would truncate other potentially valuable log lines.

System.debug however does no such truncation, so any string you pass to it should be displayed accurately in your logs.

As BobTheBuilder mentioned you can serialize your collection to JSON, as this creates a full-length string which you can then pass to System.debug and get the full un-abbreviated value. You could also iterate over your collection to build a large string yourself and debug that. Basically as long as you don’t rely on the toString implementation of system types you’re free to get log whatever you like.

Attribution
Source : Link , Question Author : Nick Kahn , Answer Author : ca_peterson

Leave a Comment