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
Sam LimSam Lim 

debug logs not generated

Hi there. 

We're having trouble getting debug logs working for our developers.

we are not able to get the debug logs for rest call API. on the following sandboxes
1. test (cs21)
2. v2dev (cs4 instance)

We have a site named 'RestCalls' and all rest resources belong to this site. we also tried adding the guest user for restCalls, however, we won't be able to get the debug logs for the call we made for these rest API. 

one more interesting thing, in CS21 even debug logs for anonymous execution is not populated

any help would be greatly appreciated! 

Thanks so much!
karthikeyan perumalkarthikeyan perumal

Following are the steps i would take to solve this issue:

Sometimes the web-services are invoked by user-accounts dedicated to Integration or Web-Services. If that is true, did you try to add that user in Debug Logs?

Check the the "Log Filters" for the Web-Service class.
Try using System.debug() without 'LoggingLevel' Option.
Its possible to miss debug logs , if there are so many debug logs generated in short period of time. Salesforce can Only hold up-to 20 request at any given time. Open Developer console before you invoke the service. Salesforce automatically refreshes the console. By this way, there are less chance to miss the Debug Log.

If you tried all the above steps and still fail to get debug logs , i would try to send a APEX email (Just for the heck of it). This is just to narrow down the issue and figure out if the issue is really with Debug Logs.

Hope this will help you, 

Mark it Best ANSWER if your issue fixed. 

Lalit Mistry 21Lalit Mistry 21
The below salesforce article should help you with debugging.
Akhil AnilAkhil Anil
Hi Sam,

After the Winter 17 release, Salesforce has by default disabled debug logs for guest users. To see the debug logs for guest users, the browser through which the guest user is accessing should have a special cookie enabled. If the guest user is coming through an API request, then even the request should be appended by a special cookie in the header.

As per the below documentation on Winter 17, , The debug logs are collected for site visitors who are using the Guest User license only when a public user’s browser has a special cookie.

The value of the cookie should be
Name : debug_logs
Value: debug_logs

To set this cookie via Chrome, Navigate to the Site URL,
Go to Developer tools and then to Console tab, Execute the below javascript
document.cookie ="debug_logs=debug_logs;";

Also if you access the site using API, you can set the cookie in the same format. For example, when connecting to the site using JAVA, you can
use URLConnection class and set the cookie value as below
URL url = new URL("http://*********");
    URLConnection con = url.openConnection();
    con.setRequestProperty("Cookie", "debug_logs=debug_logs,");
    con.setRequestProperty("Content-Type", "text/plain; charset=utf-8");

If that works kindly mark an answer so that we can close this thread.


Sai BhetanabotlaSai Bhetanabotla
@Akhil Anil,
This helped me.