Bugfix: Entry Save Override Is Not Always Used
Thanks again to @jvega-intakedesk & team for reporting issue #856 (via discussion #855), helping to test PR #857! 🥳
Core Unlocked Package Changes
Quick context on this release: in Apex, developers have the ability to force certain entries to always save, even if the entry's logging level doesn't meet the current user's logging level (e.g., a DEBUG entry can be made to always save, even if the user's logging level is set to INFO). This is useful for a lot of teams in a lot of situations (such as auditing/monitoring requirements), and has been a feature for a loooong time.
But, @jvega-intakedesk & team recently pointed out that although the LogEntryEvent__e platform events are successfully published, the corresponding LogEntry__c records are inadvertently not created. This release corrects this issue with a few changes:
-
Added new fields
EntrySaveReason__conLogEntryEvent__e&LogEntry__cto explicitly track why an entry is saved, with 2 possible values:Logging Level Met: indicates that the entry was saved because the entry's specified logging level meets the logging user's configured logging level settings, stored inLoggerSettings__c.LoggingLevel__c.Save Overridden: indicates that the entry was saved because a developer has overridden in code theshouldSaveflag for the entry. This is done by developers to ensure certain entries are always logged, regardless of the user's configured logging level.
-
Updated
LogEntryEventBuilderandLogEntryEventHandlerto set the new fields onLogEntryEvent__eandLogEntry__c.- ℹ️ Going forward, all new
LogEntryEvent__eandLogEntry__crecords will now have a value populated inEntrySaveReason__c. ⚠️ ExistingLogEntry__crecords will still havenull- no changes are being introduced to backfill the data.
- ℹ️ Going forward, all new
-
Updated the logic in
LogEntryEventHandler.filterLogEntryEventsToSave()to check the value of the new fieldLogEntryEvent__e.EntrySaveReason__c. Any entries with a save reason ofOverrideare always saved inLogEntry__c(which is the piece that directly fixes #856). -
The flexipage
LogEntryRecordPagehas also been updated to display the new fieldLogEntry__c.EntrySaveReason__cwhen it's populated. For any existingLogEntry__crecords with anullvalue, the flexipage will hide the field.
Installation Info
Core Unlocked Package - no namespace
- SF CLI:
sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015pGKQAY - Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015pGKQAY
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015pGKQAY

