Winter 17: Setting Debug Logs For Site Guest User, Set A Browser Cookie To Enable.

Guest site user debug is not showing in debug log, it is related to Winter 17 change. Now need to set a special cookie from their side so that Salesforce will generate logs only when that user accesses the site.

Public users generate a large volume of events, which can quickly fill up your debug logs. For this reason, logs are collected for site visitors who are using your Guest User license only when a public user’s browser has a special cookie. This feature is available in both Lightning Experience and Salesforce Classic.

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 java-script
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();

Leave a Reply

Your email address will not be published. Required fields are marked *