I would need to print all the elements of a list so to be able to copy them (CTRL+C) . In Debug Log , I can see only the first 10, or something similar . (a temp solution I'm using is to store them in a Long Area Text field, but I think there's a more efficient solution).

3 Answers 3


I do it like this, if I want to see records in the debug log. Or query for them directly in execute anonymous and debug them from there.

string s = '';
for (record__c r : listOfThings) s += '\n' + r;

You could use JSON serialization to format all the records in the collection.


List<Account> accs = new List<Account>();
for(integer i = 0; i < 50; i++) {
    accs.add(new Account(Name='Account-'+i));
  • Definitely the best answer - no need for a loop to print the List
    – cyberspy
    Sep 3, 2021 at 9:18

you don't need to change code for this. There is a Chrome plugin which shows debug log nicely formatted. This is the link to that plugin: https://chrome.google.com/webstore/detail/apex-debugger/mpckkbblhbfngaininanfjpdfjhbncjo?hl=en

  • This won't change the fact that, for Lists that are printed, only 10 values are sent to the debug log. You can see this if you view the raw log - no amount of 'pretty printing' is going to 'expand' the 3 little dots at the end of a line into actual values. Still, looks an interesting plugin so I'm gonna give it a try anyway - just not for the reason you suggest ;)
    – cyberspy
    Sep 3, 2021 at 9:14

You must log in to answer this question.