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.

2 Answers 2


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.

  • Given the limitations mentioned. Looks like this is the best option. Thank you @sfdcfox
    – Jorjani
    Commented Apr 10, 2018 at 17:56
  • Resurrecting the question - so if I have many Users and I want to trace a specific class I need to activate debug logs on ALL Users (with None level) and activate class log with specific level? The idea is I want to debug a class, I don't know which User will hit the class next. Commented Jun 3 at 12:35
  • 1
    @AndriiMuzychuk That's correct. If you don't have a user trace flag, they won't be logged, no matter what the other flags are set to (e.g. the class).
    – sfdcfox
    Commented Jun 3 at 17:09

The short answer is, you can't. The class specific debug levels only control how verbose the logging for those classes are.

When the user executes an action, all the classes within the same context are logged. Theoretically, you can make this easier on yourself by lowering the debug level of all of the classes you don't care about that you expect to show up within the same context but that's still not even close to what you want.

You can try to implement a custom logging tool but even then, you're not going to get true logging. You'll only get the information you tell it to give you (which may work for your needs).

What I typically do is talk to the user I'm trying to debug. Tell them to stop clicking on things, delete all the debug logs, then tell them to click the one button that executes the action you want logged.

  • 1
    Thanks for the answer! In this case, the user is an API user doing many time-sensitive transactions that I can't stop. So looks like I'll have to live with this for now.
    – Jorjani
    Commented Apr 10, 2018 at 17:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .