4

I have a class that has too many SOQL query error. Normally I'd set debug log levels to my DB Trace level

DB Trace Log Level

When I run my test method that throws the error, the logs are too large so it only shows 3 queries. In examining the logs I can clearly see that many of the items that should be supressed are not:

Bad Log Entries

According to this documentation, the STATEMENT_EXECUTE and HEAP_ALLOCATE events should only be recorded with Apex Code level finer or higher. The VARIABLE_ASSIGNMENT event should only be recorded at Apex Code Finest level.

Since my Apex Code is set to none, these events should not be in my log but they are.

Is this a bug or am I terribly misunderstanding how this all works?

More

The debug level is on my own user (sf admin). The logs are being generated by running a test method from the dev console. I verified that the dev console has 0 class log level overrides that could be taking priority.

1

It seems that if you modify log levels in the dev console it creates an active User Trace Flag in the debug logs list with the level of "SFDC_DevConsole".

I tested this in an isolated org with no User Trace Flags on the debug log screen to verify.

More

I deleted the log that was created this way and ran some code in the execute anonymous window and the User Trace Flag popped back up in the debug log screen.

I deleted this User Trace Flag and I ran the most basic test class I could find in my isolated org and again, the log popped back up.

I modified the log level of this auto-generated User Trace Flag and re-ran some code. The log levels were honored.

It seems that in order to get what I need I need to modify the level in the auto-generated User Trace Flag as opposed to working on one I created manually. This is rather annoying still as there's no easy way to tell the difference between the two except for perhaps the auto log is always set to SFDC_DevConsole (or so it seems).

Fix??

This fix worked in my own test org but it did not work in my companies org

  1. Delete ALL user trace flags for the user you want to track (probably yourself) If you skip this step you will get an error on step 3
  2. Run `system.debug('Hello World');' in the anon window to generate a trace flag
  3. Modify the traceflag to use the desired level
  4. Run the code you want to troubleshoot

Update

The only way to get what I needed in my companies org was to modify the SFDC_DevConsole log level.

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.