0

The document Debug Log Filtering for Apex Classes and Apex Triggers

says log filtering can be "turned off" for a particular class. How is this done? I have a class1 calling calling class2. Class2 has sensitive information that shouldn't be thrown in the debug logs. I have class1 log set to finest. Class2 is inheriting this log level. How do I override that?

The document has class1 calling class3 calling Utility Class(Class1->Class3->Utility Class) .Class3 inherits Class1's log level. "However, UtilityClass has already been tested and is known to work properly, so it has its log filters turned off". How is this done?

1 Answer 1

1

This mechanism is not meant to protect sensitive information. If you need to limit debugging for this purpose, use a Managed Package. The feature you've linked to is only about limiting logging for purposes of excluding logic from a debug log. To do this, set up a TraceFlag that specifies a TracedEntityId for the specific class that you want to exclude, and set all fields to NONE. This disables logging for that class. Note that any administrator can set these values, which is why it is not suitable for securing sensitive information. Note also that the document you linked to has a link to a page that describes how to set up these trace flags using the user interface in Setup.

4
  • I see. My sensitive class is a customAuth implementation. The debug is throwing client id and client secret, I'll try managed package, Thanks!
    – premkris
    Commented Feb 16, 2022 at 16:46
  • The obvious solution is to simply remove the debug logging statements from the code, of course :)
    – Phil W
    Commented Feb 16, 2022 at 18:23
  • 1
    @PhilW With sufficient logging levels, you'd still see VAR_ASSIGNMENT entries, which would expose that data anyways.
    – sfdcfox
    Commented Feb 16, 2022 at 18:25
  • 1
    This is of course true, even with static variable declarations. Yeah, that was tongue-in-cheek but got a really important and clear reposte! Bravo!
    – Phil W
    Commented Feb 16, 2022 at 18:31

You must log in to answer this question.

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