How Can I Get Debug Log for Guest User in a Salesforce Site?

Question
Normally, you can enable debug monitoring on a specific user to troubleshoot errors they encounter, such as the generic “Error Loading a Visualforce Page.” However, when debugging a Salesforce public site, how can you capture debug logs for the guest user?
Answer
You can enable debug logging for the guest user by going to Environments > Logs > Debug Log in Salesforce. Instead of entering a username, enter the Site Name as the user.
Enroll at CRS Info Solutions, a premier Salesforce online training institute. Book your free demo session now and start your journey to mastering Salesforce!
For example, if your site is named “MySite,” enter MySite as the username. This method is not well-documented but provides the required debug logs.
Update on Debug Logging Changes
Previously, in Winter ’17, Salesforce required setting a browser cookie (debug_logs) to activate logging for guest users. This was introduced to prevent excessive logging due to shared guest user licenses, which could fill up logs and cause truncation. However, this change complicated debugging, especially for asynchronous processes and webhook integrations.
As of Spring ’18, Salesforce has removed the requirement for the debug_logs cookie. Public users no longer need to set a browser cookie to trigger debug logging. This applies to both Lightning Experience and Salesforce Classic, making debugging guest user activity much easier.
Summing Up
To capture debug logs for a Salesforce public site guest user, enter the Site Name instead of a username in Environments > Logs > Debug Log. The previous requirement to set a debug_logs cookie was removed in Spring ’18, making the process simpler. This change allows easier debugging of guest user activity without additional browser settings.
Accelerate Your Salesforce Career in Seattle
Elevate your Salesforce skills with expert-led Salesforce online training in Seattle, tailored for both beginners and professionals. Gain practical experience through real-world projects and master cloud-based CRM solutions with guidance from certified instructors. Unlock exciting career opportunities and become a Salesforce expert with comprehensive, hands-on learning at CRS Info Solutions.
CRS Info Solutions is a leading Salesforce training in Seattle, offering a thorough, real-time project-based curriculum. Our courses cover Salesforce Admin, Developer, Integration, Marketing Cloud, CPQ, and Lightning Web Components (LWC). With expert instructors offering hands-on training, we ensure you’re well-prepared for real-world challenges. Join us now to become a certified Salesforce professional and take the next step in your career.
Enroll today for a free demo at CRS Info Solutions, Seattle!!!

