You need to sign in to do that
Don't have an account?

Debug logging when using Sites
Hi,
I have a simple Site object which uses a Visualforce page, which uses an apex controller class. In this controller class, I put some debug statements (System.debug), but I am finding that the output is not being written to the log. I know for a fact that the code is being executed because other calculations in that class are executing.
Is there a reason why my debug statements are not printing just because I am calling the code from a Site? I have used System.debug in other areas where I just have a Visualforce page and an Apex class and the debug worked fine...
Thanks!
Hi, thanks for your help - that worked. When I went to Debug Logs, to my surprise there was a user for every Site object I had. The name of the user was "Site Guest User, Name of Site" and when I selected the one for my site the logs showed up.
Thanks!
Mara
All Answers
Hi 1trinity,
I don't have a solution for you. But my thinking is that you might be running the site as another / anonymous user?
Try using the UserInfo object to print the userid somewhere and check if was acctually your user. I would be surprised if debug logging did not work with sites.
Cheers!
Martin
Hi,
To track the code through debug log in sites, for this you can give the guest user in debug log directly go to setup-> administrative permisison-> Monitoring-> debug log-> select Guest Uesr to debug for sites.
Hi, thanks for your help - that worked. When I went to Debug Logs, to my surprise there was a user for every Site object I had. The name of the user was "Site Guest User, Name of Site" and when I selected the one for my site the logs showed up.
Thanks!
Mara
Post WInter '17, you may need to set a cookie for your requests, even after you have selected the Guest User for debug logging:
https://releasenotes.docs.salesforce.com/en-us/winter17/release-notes/rn_forcecom_debugging_guest_user.htm