[SalesForce] How are we supposed to use debug logs for a specific Apex class only

I'm trying to capture the logs for a specific class for a user with a lot of transactions (hundreds in any given minute). For example, the user will have 100 transactions done in a minute that will show up if I turn on debug logs for it; however, I am only interested in seeing the logs for 2 of those transactions that are related to a specific class (e.g., Accounts.cls). I saw the following message on the debug page:

"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. "

enter image description here

So how can I target my debug logs to only show the logs for that one specific class and exclude all the others? I found this question to be somewhat relevant but not exactly the same.

Best Answer

Realistically, all you can do is set the user trace flags to a debug level with all levels set to "none", then set the class's log to a debug level that you want. Yes, you'll still be generating a ton of logs, but the irrelevant logs will all show up as 1Kb, while the ones you want will be significantly larger. If you're using the Developer Console, you should even be able to click on the Size column header to sort by size; all of the ones you care about will be near the top/bottom of the list.

Related Topic