function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AndrewTaylorAndrewTaylor 

System.debug messages not in Debug Logs

I am investigating some failing unit tests, and added some debugging in place.  However, the problem is the System.debug messages do not print to the Debug Logs.

What configuration do I need in my Debug Level to see these? I've currently got Apex Code, System and Apex Profiling set to Finest, Finest and Fine, respectively, and the System.debug messages just aren't being printed.
Best Answer chosen by AndrewTaylor
pconpcon
That may be part of your problem.  If you set it too high you may get too many messages and they will truncate.  What I would suggest is you set everything to ERROR and then do your debug statements like
 
System.debug(System.LoggingLevel.ERROR, 'message goes here');

This will log them at the error level and you won't get the other cruft.

All Answers

pconpcon
That may be part of your problem.  If you set it too high you may get too many messages and they will truncate.  What I would suggest is you set everything to ERROR and then do your debug statements like
 
System.debug(System.LoggingLevel.ERROR, 'message goes here');

This will log them at the error level and you won't get the other cruft.
This was selected as the best answer
AndrewTaylorAndrewTaylor
Apologies, I forgot to reply to this afterwards; adding the logging level did the trick.  Thank you!
Elio ShytiElio Shyti
Worked for me also!
rubel rana 6rubel rana 6
Hi @pcon, where can I see the message after writing this code?
System.debug(System.LoggingLevel.ERROR, 'message goes here');

Kind regards,
Rubel