2

Can anyone enlighten me - what is the purpose of DebugLevelId on Tooling API TraceFlag object?

If it is now a required field then what is the purpose of all log level fields (e.g. ApexCode, ApexProfiling, etc) on TraceFlag ?

Contrary to the documentation DebugLevelId appears to be a required value. If I try to insert TraceFlag without DebugLevelId then SFDC returns error

DebugLevelId is required

However, with TraceFlag.DebugLevelId specified, it seems that whatever Log Levels are set on DebugLevel they take precedence over values set on Trace Flag.

For example If I create DebugLevel record with ApexCode = DEBUG and assign Id of that DebugLevel record to a TraceFlag record with ApexCode = FINE then value from Debug Level seems to take precedence.

In the past (API v34) it was possible to create TraceFlag on its own (without DebugLevel), now (API v36) there seem to be no way to create TraceFlag without DebugLevelId, and log level values (e.g. ApexCode, ApexProfiling, System, etc) on TraceFlag are simply ignored.

Is this a bug or I am simply missing something?

1

This was a change made in Winter '16 (v35.0) - Release notes Salesforce Winter ’16 Release Notes.

As you found, the DebugLevel is now required and takes precedence over the TraceFlag defined levels. I've just gone with the change and used a DebugLevel that gets inserted/updated (upsert didn't work at the time) before the TraceFlag is created.


I haven't revisited it, but at the time if two developers opened the developer console at the same time they would be sharing a single DebugLevel record. Salesforce Debug logs with the Winter '16 Developer Console

  • Hello Daniel, thank you for the information and links, they were helpful. By the way - it looks like Debug values (e.g. ApexCode = FINE) set on TraceFlag are no longer relevant and do not have to be set because they are overridden by those set on DebugLevel. Is this your observation as well? I did a couple of tests and it seem that way. – gaiser Apr 15 '16 at 8:51
  • @gaiser Yes, I've found the DebugLevel takes precedence. Somewhere was a page or blog post that explains the order that logging is applied, but I can't find it. – Daniel Ballinger Apr 15 '16 at 20:34
  • Thank you for the confirmation Daniel. If you come across that blog post please post it here if that's not too much trouble. The answer may benefit from it. – gaiser Apr 16 '16 at 13:58
  • Found the post I was thinking of - Does the Summer ’15 release remove the ability to set test logging levels with the DebuggingHeader?. Basically the TraceFlags override the DebuggingHeader on the request. – Daniel Ballinger Apr 17 '16 at 19:43
  • 1
    Hello Daniel, thank you for the link. It has actually answered two of my questions at once. The other one (which I did not explicitly ask here) is - why DebuggingHeader seem to make no difference with Tooling API. Now I know. Shame about the loss of DebuggingHeader capability with Tooling API. – gaiser Apr 18 '16 at 8:11

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.