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
jpatel@alternajpatel@alterna 

system.debug message and debug logs not getting created

I have a visualforce page and it is connecting ot a custom controller.
I have a button on the VF page which trigger an action method in the controller.
<apex:commandButton title="Proceed" action="{!firstPageNext}" styleClass="btn img-btn pull-right"></apex:commandButton>
My controller method is like this
public void firstPageNext()
{
	system.debug('first page next is executing');
	system.debug(LoggingLevel.Info, 'first page next is executing');
	system.debug(LoggingLevel.Finest, 'first page next is executing');
	system.debug(LoggingLevel.Debug, 'first page next is executing');
	system.debug(LoggingLevel.Error, 'first page next is executing');
	
	... and some other stuff
}
I can confirm that my `... and some other stuff` part of the code is being executed. The problem I am having is that my `system.debug` message is not displaying in Developer Console Logs or Debug Logs. I crated new debugs rule but I still don't see any debug log or message showing anywhere when my action method got executed. 

What is it that I am missing?

Thanks

Rules Created


 
Akshay_DhimanAkshay_Dhiman
Hi Phi,
Below is a code for the same . Please note the following things you have to check
Please check that in your visualforce page you have added the controller to the page.
In debug log , please delete all the List under ‘User Trace Flag’.
After creating  the User , click on filter and change the ‘APEX CODE ’ picklist to ‘DEBUG’ and ‘SYSTEM’ picklist to ‘DEBUG’
After creating the log , set the date and time for that particular user name.
Visualforce Code :
<apex:page controller="testing">
    <apex:form>
    	<apex:commandButton title="Proceed" action="{!firstPageNext}" value="Testing button"></apex:commandButton>
    </apex:form>
</apex:page>

Controller Code :
public class testing {
    public void firstPageNext()
    {
        system.debug('first page next is executing');
        system.debug('first page next is executing');
        system.debug('first page next is executing');
        system.debug('first page next is executing');
     }
}
Works Fine in my developer org.
Below the GIF and screenshot .Hope that will help you.
User-added image

User-added image
Regards,
Akshay


 
jpatel@alternajpatel@alterna
Hi Akshay,

Thank you for your reply. I have tried your code and it does display me the logs in developer console.

However, I probally didn't mention this but, the VF page and the custom Controller that I am tyring to add System.Debug() message now are both from an existing single page application which is now working in production. This mean that the Controller is for sure added to the VF page and everything is working fine.

The VF has so many buttons, and  each of them is invoking a controller method. And, I have tried to place System.Debug message at the beginning of each of those method in the controller but I never get to see any logs appears.

What do you think could be going wrong?

Thanks

 
jpatel@alternajpatel@alterna
I have some finding and maybe this help better describe the problem?

So I have a VF page called MyTestPage and in there I have a few System.Debug(...) lines. Ofcourse I do have a custome controller for that.

When I browse the VF page by clicking on the Preview button then I am able to see my debug messages when I am going throught MyTestPage. And in this case, the VF page url will look something like this https://c.cs14.visual.force.com/apex/MyTestPage.

However, if I access it via a custom Site URL (https://myDomainName.cs14.force.com/mySiteName/apex/MyTestPage) then I will not able to see my debug message.

Any idea why?

Thanks
tlfutlfu
In your first case your code is executing in the context of your logged in Salesforce user. In the second case, your code is executing in the context of the Site Guest user. It's likely that you need to add trace filters specific to the Site Guest user if you want to see your debug messages when you access your page via the custom Site.