9

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

7

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.

  • Hi Thomas, Thank you for your response and thank you for your details on trace flags. I have done the three steps above but see no new logs. And when I press clear old logs will not disappear. One more thing is that I had to do the fix today again with deleting old trace flag since I couldn't create a new user to debug on. I will create a case – nickwick76 Sep 15 '13 at 7:08
  • Did this ever get fixed? I am experiencing the same issue now almost exactly 2 years on. Pity whatever bug is responsible hasn't been fixed yet. – e_m0ney Sep 1 '15 at 8:54
  • @e_m0ney - It still does not work on Safari, however, on google chrome it all works as expected. I would give chrome a try and see if it resolves your issue – Eric Sep 1 '15 at 13:15
  • @Eric I was working in chrome. on linux – e_m0ney Sep 2 '15 at 1:13
3

I've had times when I can't ever get logs to show up for the current user or other users. It seems like bad data can get stuck in the trace settings.

I'm usually able to work around with one of the following

  • Manually add my user to the monitored users in the Debug Log
  • If already in the monitored users, delete and readd
  • In the dev console, change the current log levels and expiration and save
  • Close and re-open the dev console
2

The following work around works for me: create a dummy but valid execute anonymous entry String a; then when you need the logs panel refreshed press 'Ctr + Alt + E' which re-runs the execute anonymous code and as a side effect updates the 'Logs' panel.

I could not get 'Clear' to work either - I delete them through the 'Debug Logs' in the org's administration.

2

I had this issue, almost 2 years after the ticket was opened.

If I had to guess why this is happening, I would say that when you reach some size limit for retained logs, instead of rolling the logs or something sensible like that, salesforce deactivates log collection for the user without warning. Salesforce - whatever it is, fix this!

To Fix:

  1. I navigated to the "Debug Logs" item from the setup menu.
  2. Deleted all logs for the user
  3. Re-added the user as a "Monitored User"

Elliott

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.