Package Edition of Nebula Logger
Unlocked Package
Package Version of Nebula Logger
4.18.2
New Bug Summary
Summary
When Log__c records are created without a LoggedBy__c value (anonymous/null context), the LogRetentionDate__c field defaults to the metadata field default value (14 days) instead of falling back to the org-level LoggerSettings__c.DefaultNumberOfDaysToRetainLogs__c setting.
We experience this issue as we generate logs by creating platform events (LogEntryEvent__e) from Mulesoft. In this scenario, the LoggedBy__c field ends up as null.
Impact
This causes anonymous logs to be purged prematurely based on the hard-coded field default rather than respecting the organization's configured retention policy.
Steps to Reproduce
- Configure org-level Logger Settings with
DefaultNumberOfDaysToRetainLogs__c = 60
- Create a
Log__c record through platform events (LogEntryEvent__e), or other method ensuring that LoggedBy__c on create is null
- Observe the resulting
Log__c.LogRetentionDate__c value
Expected Behavior
Anonymous logs should respect the org-level Logger Settings hierarchy:
- Expected:
LogRetentionDate__c = CreatedDate + 60 days (org setting)
- Settings hierarchy should be: User → Profile → Org → Field Default
Actual Behavior
Anonymous logs skip the entire Logger Settings hierarchy:
- Actual:
LogRetentionDate__c = CreatedDate + 14 days (field default)
- Settings hierarchy becomes: Field Default only
Root Cause Analysis
Code Analysis
In LogHandler.cls (lines 159-207), the setLogRetentionDetails() method:
- Calls
getLoggingUserSettings(log) to retrieve settings
- This method requires
log.LoggedBy__c to traverse the hierarchy
- When
LoggedBy__c is null, the method cannot access User, Profile, or Org settings
- Falls back to field default defined in metadata (14 days)
Package Edition of Nebula Logger
Unlocked Package
Package Version of Nebula Logger
4.18.2
New Bug Summary
Summary
When
Log__crecords are created without aLoggedBy__cvalue (anonymous/null context), theLogRetentionDate__cfield defaults to the metadata field default value (14 days) instead of falling back to the org-levelLoggerSettings__c.DefaultNumberOfDaysToRetainLogs__csetting.We experience this issue as we generate logs by creating platform events (
LogEntryEvent__e) from Mulesoft. In this scenario, theLoggedBy__cfield ends up as null.Impact
This causes anonymous logs to be purged prematurely based on the hard-coded field default rather than respecting the organization's configured retention policy.
Steps to Reproduce
DefaultNumberOfDaysToRetainLogs__c = 60Log__crecord through platform events (LogEntryEvent__e), or other method ensuring thatLoggedBy__con create is nullLog__c.LogRetentionDate__cvalueExpected Behavior
Anonymous logs should respect the org-level Logger Settings hierarchy:
LogRetentionDate__c = CreatedDate + 60 days(org setting)Actual Behavior
Anonymous logs skip the entire Logger Settings hierarchy:
LogRetentionDate__c = CreatedDate + 14 days(field default)Root Cause Analysis
Code Analysis
In
LogHandler.cls(lines 159-207), thesetLogRetentionDetails()method:getLoggingUserSettings(log)to retrieve settingslog.LoggedBy__cto traverse the hierarchyLoggedBy__cis null, the method cannot access User, Profile, or Org settings