+ Start a Discussion
Raj R.Raj R. 

How come I cannot see my System.Debug statements in the debug log?

Hi,
It seems like no matter where I put my System.debug statement, I cannot find it in my debug log. I have already set myself up to track debug logs, etc, but for some reason I can only see the debug log at the end of my Apex class.

What reasons would there be for not being able to see the system.debug statements in a debug log? I already have the appropriate setting and can see the debug log, but it does not contain the debug statements I need. Please advise
Best Answer chosen by Raj R.
James LoghryJames Loghry
How large are your debug logs?  It's possible your debug logs are too verbose / large and not displaying your debug statements.  I would do a few things:
  1. Add debug statements throughout the beginning, middle, and end of your code execution.  This will help pinpoint where your debug statements simply won't show up anymore.
  2. Add a prefix to your debug statements like your initials, which you can easily search on.
  3. Set the debug level to INFO e.g. System.debug(LoggingLevel.INFO,'JL Testing McTesty Testerton');
  4. Filter your debug logs (There is a filter link on the left hand side when you create your debug log for your user).  Turn everything off except for Apex Code, which you will set to INFO.  This should drastically reduce your debug log size and make it easier to find your statements.
If the above still doesn't help, then it's likely the code you're expecting to execute is not executing, and it's time to do some additional debugging.

All Answers

Boris BachovskiBoris Bachovski
Check you debug log levels in your console and also check your class/trigger override log levels, make sure they're set to DEBUG at least.
James LoghryJames Loghry
How large are your debug logs?  It's possible your debug logs are too verbose / large and not displaying your debug statements.  I would do a few things:
  1. Add debug statements throughout the beginning, middle, and end of your code execution.  This will help pinpoint where your debug statements simply won't show up anymore.
  2. Add a prefix to your debug statements like your initials, which you can easily search on.
  3. Set the debug level to INFO e.g. System.debug(LoggingLevel.INFO,'JL Testing McTesty Testerton');
  4. Filter your debug logs (There is a filter link on the left hand side when you create your debug log for your user).  Turn everything off except for Apex Code, which you will set to INFO.  This should drastically reduce your debug log size and make it easier to find your statements.
If the above still doesn't help, then it's likely the code you're expecting to execute is not executing, and it's time to do some additional debugging.
This was selected as the best answer
hy.lim1.3897974166558203E12hy.lim1.3897974166558203E12
is it in Sandbox & Email to Case?

refer here -> Debug Logs via Sandbox for Email to Case does not capture logs (https://success.salesforce.com/issues_view?id=a1p30000000SviNAAS)
AshlekhAshlekh
HI,

Debug log has limit to show log some time it doesnt show log due to size of you debug exceed size. Instead log you can SKIPPED word in Debug log.
nbknbk
Hi,

Put the debug statements as suggested by James, it will show in debug log.

Set the debug level to INFO e.g. System.debug(LoggingLevel.INFO,'JL Testing McTesty Testerton');

As per your comments you able to view the debug statements at the end of apex class, is it throwing any exceptions due to this you are not able to view debug statements! please double check.

Alternatively use get/set variable and store the debug value to that and use the same variable in vfp.
class:
ex: global string debugvalue {get;set;}
debugvalue = account.name;
VFP

<script>
   alert('the debugvalue from classis---->'+ '{!debugvalue}');
</script>

Hope this helps.

Ian Lin 157Ian Lin 157
I recently had this issue and after clicking renew button in debug logs, I was able to see all the logs that were previously missing. Hope this helps.

Thanks,
Srinath.