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}), ...} <<<<<

4 Answers 4


[UPDATE 2022]: This is no longer true (for some time already), see other answers.

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.

  • 3
    This is no longer true. Even using JSON.serialize(), single-line strings are limited to 500 characters. For Objects or Collections, the linebreaks inserted by JSON.serializePretty() will let you exceed 500. Alternately (or in addition), you can use regex to inject newline characters directly into your string before debugging.
    – Aubry
    Commented Jan 4, 2020 at 20:42

The JSON.serialize(...) trick no longer works, if one needs un-truncated messages following wrapper class is what I use, I just paste it as helper method at bottom of the apex class in those situations I need un-trunctated logs:

public void mDebugUntruncated(String sMsg) {
    for (Integer i = 0; i < sMsg.length(); i=i+300) {
        Integer iEffectiveEnd = (i+300 > (sMsg.length()) ? sMsg.length()-1 : i+300);

Then for example you would call it as you would call it with:

this.mDebugUntruncated('=== QV_QuickLinkListLoader.getContent(...):`JSON.serialize(sJSONRequest)=' + JSON.serialize(sJSONRequest) +'`');

un-trunctated salesforce debug message

  • 1
    This seems to truncate the last character for the last debug line. Commented Nov 6, 2019 at 19:40
  • 1
    Yeah, remove the -1's from line 3 Commented Jan 1, 2020 at 0:18
  • 1
    Updated, thanks @SephCordovano Commented Jan 10, 2020 at 17:08

If you are debugging large objects or lists, enclosing your debug contents with JSON.serializePretty(), eg:


will insert line breaks, which allow your debug to exceed the normal character limit. For long solid strings, however, you will need to inject linebreaks manually, which I do using this:

public static void multiLineDebug(Object debugContents){
    String debugText = JSON.serialize(debugContents);
    Pattern lengthLimit = Pattern.compile('(.{299})');
    debugText = lengthLimit.matcher(debugText).replaceAll('$1\n');

If you prefer one-line solutions, you can do this:

system.debug(Pattern.compile('(.{299})').matcher(JSON.serialize( /* PUT YOUR DEBUG CONTENTS HERE */ )).replaceAll('$1\n'));

Though I suspect there are some issues with optimization there.

  • 1
    This is a working solution, I just tested it!
    – Jojosfdc
    Commented Jun 11, 2021 at 12:06

Wrapping your list variable with JSON.serialize(your_list_here) should solve your issue.

For example:


  • 3
    This does not appear to be working for me anymore, anyone else have truncation even with the JSON.serialize trick? Commented Apr 15, 2019 at 13:42
  • @DanielSokolowski did you find anything on it? Commented Apr 23, 2019 at 18:15
  • @apple123 I ended up creating a small wrapper class for whenever I need to workaround this limit. – Commented Apr 23, 2019 at 18:51
  • @DanielSokolowski that sounds interesting, would you be kind enough to share a few details on it? or a little snippet of the code? Commented Apr 23, 2019 at 22:18
  • @apple123, yes of course, see my answer below (or above). Commented Apr 24, 2019 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .