1

When I run this script successfully, I do not get my system.debug lines showing up in the console log. But I do get them if I remove the DML Update statement. Is there a good reference guide, that shows how the logs determine what gets logged?

list<Opportunity> opps = [SELECT id, Channel__c, Name, (SELECT id, role, isPrimary FROM Partners) FROM Opportunity Where Channel__c = '' AND isClosed = false];
system.debug(opps);
for(Opportunity o : opps){
    System.Debug('ZZZ : '+o.Name);
    if(o.Partners.isEmpty()) {
        o.Channel__c = 'Direct';
        System.Debug('     ZZZ Size : '+o.Partners.Size());
    } else {
        o.Channel__c = 'Partner';
        System.Debug('     ZZZ Size : '+o.Partners.Size());
    }
    for(Partner p : o.Partners){
        System.Debug('     ZZZ : '+p.role);
    }
}
update opps;
2
  • 1
    Are you seeing a "Skipped X bytes of detailed log" or MAXIMUM DEBUG LOG SIZE REACHED message? Commented Apr 18, 2017 at 5:14
  • Hey Daniel, yes indeed. I was not aware specific pieces were removed from the log to make space for more important pieces. I assumed the log just truncates. apparently not. Commented Apr 18, 2017 at 21:17

1 Answer 1

3

What is the size of your debug log?

If it is over 2MB SF truncates it and your debug statements can get discarded. Seems when you add in the DML a bunch of stuff occurs thus bloating the log.

To get the specific debug statements in that case change your debugs to:

system.debug(Logginglevel.ERROR,YOURDEBUGHERE);

And then change the logging levels to error

This is essentially a duplicate of: Need to get logfile smaller and several variations have been asked here many times

You must log in to answer this question.

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