[SalesForce] Debugging logs in Developer Console is not working

I have had some problems debugging lately. For one thing I had problem even registering a user to monitor. This was because of Winter '14 and there is a fix for it (see this post). This way you will get the debug logs generated in the Salesforce debug logs view.

But I am used to working in the developer console with this. And there seems to be problems there as well that are not fixed by this patch.

'Show my current logs only' is checked by default. When you deselect it it will display lots of debug logs (older ones done by yourself perhaps). But it will not generate debug logs for monitored portal users for example.
One thing gives me logs though and that is if I press 'Change Log Levels' and point out a specific class.

'Clear' doesn't work either.

And yes, I have resumed updating logs.

Ideas anyone?

Best / Niklas

Best Answer

Just so I understand, you did the following steps:

  1. Set the monitored portal users in the Debug Log Page
  2. Open the developer console and unchecked "Show my current logs only" (sort by time so new logs show up on top)
  3. Executed apex as the portal user

After those steps, a log should appear in the developer console or the Debug Logs page. If no log appeared with the user in the monitored users list, then you should open a case.


Let me take a minute to go over how Trace Flags are used. Trace Flags have 3 different fields we care about.

  • scopeId : The scope at which we generate a "debug" or "system" log. The only difference is the way the logs are stored. Supports either a user id, empty id, or null.
  • tracedEntityId : The entity we want to trace. Either a user id or an apex class/trigger.
  • expirationDate : When we should we stop logging.

Monitored users (debug logs) create a trace flag with a scopeId = null and tracedEntityId = "id of user to monitor".

Developer console (system logs) create a trace flag with a scopeId = "id of you" and traceEntityId = "id of you". If you close the developer console, it will expire just that one trace flag so system logs stop being generated. This is what happens when the developer console is open for too long being "idle" is the trace flags expire, so resume will re-enable the trace flags. The log panel in the developer console only shows apex logs create by you since the console was open or 'Clear'ed. When you uncheck "Show my current logs only" it should show all the apex classes on the org, regardless of user or type.

If you set up class level filtering, it will create a trace flagwith the tracedEntityId to the class you want, and will be applied for all users (debug and system).

When I say "create" above, I really mean it will check if one already exist. If so, it will update the expiration date. If not, it will create one. That known issue specific to monitored users in the Debug Logs page is because it wasn't setting the expiration correctly. That is why deleting it works, because then it will create a new one.

Related Topic