Name two required steps for enabling debug logging for unauthenticated Guest Users accessing public Sites. Choose 2 answers
A. Install the Sites Page Inspector plugin for Chrome
B. Set a browser cookie with a name value of "debug_logs" and a domain value of ".force.com"
C. Set the "Assigned Users" in the Site "Public Access Settings" to include the built-in Debug User
D. Check the "Enable Guest Access Logging" checkbox option in Site Details
E. Setup a new Trace Flag with a Traced Entity Type of 'User' that looks up to the Guest User for a Site
Answer :
B. Set a browser cookie with a name value of "debug_logs" and a domain value of ".force.com"
E. Setup a new Trace Flag with a Traced Entity Type of 'User' that looks up to the Guest User for a Site
Explanation
Set a Browser Cookie to Enable Debug Logging for Guest Users
Your 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. Logging of public users’ asynchronous activity isn’t available because asynchronous requests don’t include browser cookies. This feature is available in both Lightning Experience and Salesforce Classic.
To enable logging for a guest user’s synchronous activity:
1. Ask the user to set a browser cookie with a domain of .force.com, a name of debug_logs, and any value. (If you use a custom domain, ask your user to set the cookie for your domain rather than for .force.com.) Refer to the documentation for your user’s browser for information on adding cookies. To add cookies, your user probably needs a browser plug-in or extension for web development.
• To set a cookie for API requests made with Java code, use the URLConnection class and set the cookie value as follows.
– If you use a .force.com domain, use this code.
URL url = new URL("http://yourSite.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 you use a custom domain (for example, yourCustomDomain.com), use this code.
URL url = new URL("http://yourCustomDomain.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();
• To set a browser cookie in Google Chrome™:
a. Navigate to your site.
b. Open the Chrome DevTools Console by pressing Ctrl+Shift+J (Cmd+Opt+J on macOS).
c. Execute a command to set the cookie.
– If you use a .force.com domain, use this command. document.cookie="debug_logs=debug_logs;domain=.force.com";
– If you use a custom domain (for example, yourCustomDomain.com),
use this command. document.cookie="debug_logs=debug_logs;domain=yourCustomDomain.com";
• To set a browser cookie in other browsers, install a plug-in or extension.
2. Find the name of your site’s guest user.
a. From Setup, enter Sites in the Quick Find box, then select Sites.
b. Select your site from the Site Label column.
c. Select Public Access Settings > View Users.
3. Set a user-based trace flag on the guest user.
a. From Setup, enter Debug Logs in the Quick Find box, then click Debug Logs.
b. Click New.
c. Set the traced entity type to User.
d. Open the lookup for the Traced Entity Name field, and then find and select your guest user.
e. Assign a debug level to your trace flag.
f. Click Save
A. Install the Sites Page Inspector plugin for Chrome
B. Set a browser cookie with a name value of "debug_logs" and a domain value of ".force.com"
C. Set the "Assigned Users" in the Site "Public Access Settings" to include the built-in Debug User
D. Check the "Enable Guest Access Logging" checkbox option in Site Details
E. Setup a new Trace Flag with a Traced Entity Type of 'User' that looks up to the Guest User for a Site
Answer :
B. Set a browser cookie with a name value of "debug_logs" and a domain value of ".force.com"
E. Setup a new Trace Flag with a Traced Entity Type of 'User' that looks up to the Guest User for a Site
Explanation
Set a Browser Cookie to Enable Debug Logging for Guest Users
Your 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. Logging of public users’ asynchronous activity isn’t available because asynchronous requests don’t include browser cookies. This feature is available in both Lightning Experience and Salesforce Classic.
To enable logging for a guest user’s synchronous activity:
1. Ask the user to set a browser cookie with a domain of .force.com, a name of debug_logs, and any value. (If you use a custom domain, ask your user to set the cookie for your domain rather than for .force.com.) Refer to the documentation for your user’s browser for information on adding cookies. To add cookies, your user probably needs a browser plug-in or extension for web development.
• To set a cookie for API requests made with Java code, use the URLConnection class and set the cookie value as follows.
– If you use a .force.com domain, use this code.
URL url = new URL("http://yourSite.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 you use a custom domain (for example, yourCustomDomain.com), use this code.
URL url = new URL("http://yourCustomDomain.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();
• To set a browser cookie in Google Chrome™:
a. Navigate to your site.
b. Open the Chrome DevTools Console by pressing Ctrl+Shift+J (Cmd+Opt+J on macOS).
c. Execute a command to set the cookie.
– If you use a .force.com domain, use this command. document.cookie="debug_logs=debug_logs;domain=.force.com";
– If you use a custom domain (for example, yourCustomDomain.com),
use this command. document.cookie="debug_logs=debug_logs;domain=yourCustomDomain.com";
• To set a browser cookie in other browsers, install a plug-in or extension.
2. Find the name of your site’s guest user.
a. From Setup, enter Sites in the Quick Find box, then select Sites.
b. Select your site from the Site Label column.
c. Select Public Access Settings > View Users.
3. Set a user-based trace flag on the guest user.
a. From Setup, enter Debug Logs in the Quick Find box, then click Debug Logs.
b. Click New.
c. Set the traced entity type to User.
d. Open the lookup for the Traced Entity Name field, and then find and select your guest user.
e. Assign a debug level to your trace flag.
f. Click Save
No comments:
Post a Comment