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
Hello, 

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. 

Thanks
karthik
 
Lalit Mistry 21Lalit Mistry 21
The below salesforce article should help you with debugging.
https://help.salesforce.com/articleView?id=000247187&language=en_US&type=1
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, https://releasenotes.docs.salesforce.com/en-us/winter17/release-notes/rn_forcecom_debugging_guest_user.htm#rn_forcecom_debugging_guest_user , 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
domain: .force.com

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;domain=.force.com";

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://*********-developer-edition.gus.force.com/");
    URLConnection con = url.openConnection();
    con.setDoOutput(true);
    con.setRequestProperty("Cookie", "debug_logs=debug_logs,domain=.force.com");
    con.setRequestProperty("Content-Type", "text/plain; charset=utf-8");
    con.connect();

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

 

 
Sai BhetanabotlaSai Bhetanabotla
@Akhil Anil,
This helped me.