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;
  • 1
    Are you seeing a "Skipped X bytes of detailed log" or MAXIMUM DEBUG LOG SIZE REACHED message? – Daniel Ballinger Apr 18 '17 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. – NZ Dev Apr 18 '17 at 21:17
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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.