[SalesForce] the purpose of Apex Class Trace flags

I have an Apex Batch Class that I'm trying to view the debug logs for. I know that I can do this in the Dev Console, but the data and amount of logs its returning is causing the Dev Console to freeze.
The approach I decided to take was create a TraceFlag for the class, but it appears that this doesn't actually save the logs for the class execution:

Class and trigger trace flags override other logging levels, including logging levels set by user trace flags, but they don’t cause logging to occur.

Source: (TraceFlag Help page)

I interpret this to mean that trace flags on ApexClasses do not actually save any of the logs of an apex class. Am correct in my understanding that you can only save logs at the user level?

Is there a recommended way to retrieve the logs for an Apex Class, specifically a Batch Class.

Thanks!

Best Answer

Class and trigger trace flags override other logging levels, including logging levels set by user trace flags, but they don’t cause logging to occur.

As you quoted, simply setting a class trace flag won't create a log. However, setting a user trace flag will and the class trace will override the user trace levels.

As explained in this helpful answer, the best you can do is the following:

  1. Put a User Trace Flag with all debug levels as "none". This will mean logs get created (which the class trace only does not do)
  2. Add the Class trace flag with the debug level that you want. This allows you, as you quoted, to override the settings you selected for the user trace flag (which was "none").

Now, you're left with logs getting created that would have very little to nothing (the user trace) and logs with actual information that would be the info related to the class trace.

Related Topic