[SalesForce] System.debug() not displaying in debug logs

I have a trigger called DistancesToShow that I see executing in a debug log. The trigger has a big if-then-else clause that can take it down many different paths. Based on the debug log, I can't quite tell which code path it's going down so I decided to add a bunch of debugging statements.

At the top of the trigger, right after some SOQL queries, I added the line:

System.Debug(LoggingLevel.Info,'>>>>>> inside DistancesToShow trigger');

I added several more System.Debug() messages at the top of each else clause to see which else I ended up in.

But no matter how many times I run it, I can't get it to display the message, even though it is definitely inside the trigger. I ran it a bunch of times trying to play with the different log levels, thinking I might not be understanding those. But at this point I'm logging everything and my simple debug messages aren't showing up.

I see that the trigger starts execution here:

CODE_UNIT_STARTED|[EXTERNAL]|01qi0000000Bn0P|DistancesToShow on Show trigger event AfterUpdate for [a023100000axfl7]

I then see three sets of SOQL_EXECUTE_BEGIN and SOQL_EXECUTE_END, each corresponding to an SOQL query I execute at the top of the trigger. Right below my last SOQL query is my System.Debug() message from above and it doesn't appear.

Why would my debug message not be appearing?

Best Answer

There are few things that you need to check.

In your debug level check in Apex code debug is set enter image description here

Second check your debug log size if its 2MB <= then SF skip the Debug statement in that case set all unwanted flag to none so that it will reduce your debug size and then you can see the debug. Also add a debug in start so that it give you confirmation that your debug is printed.

Related Topic