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
sungajsungaj 

Which user log to capture to debug Apex web service ?

We have an Apex class exposed as a web service that I would like to debug. I don't know which user  account I should use in setting up debug logs to capture the log output when the web service is invoked.

 

Please help.

AdminBoosterAdminBooster

You should monitor the same user that is used by the client to authenticate (getting the sessionId) before calling your WS

 

GunishGunish

Hey, 

 

There are two ways in which you can do this. 

If Your application integration, is authentication enabled (I hope it is, as it is not advisable to build open ended webservices on salesforce). Then it is the user which logs in into salesforce to make the webservice call. 

 

If for some reason, you can not get hold of the user account, which is being used, (which you should 100%) then temporarily encapsulate your webservice call into a RunAs Block, like the example shown here. 

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_tools_runas.htm

 

Then this is the user you log your debug against.

 

Regards,

Gunish Rai Chawla

 

I take 'Mark as Solution', or 'Kudos' as fees.