-
Is there a simple way in APEX to set the Origin__c value of a LogEntry__c record? For example: MyOrgLogHandler.logInfoMessage('message'); However, wrapping the Logger calls within a custom MyOrgLogHandler class will result in the LogEntry__c.Origin__c value being set to MyOrgLogHandler - and therefore not provide that added useful peice of information in the LogEntry details. This may also open the possibility to abstract managing the Log__c.ParentLog__c to relate logs across transactions for a user session when applicable - I am still trying to figure out how to go about this for user session scenarios beyond Batchable and Queueable Jobs (which already have clear examples provided in the documentation). I would also be appreciative of any suggestions to this end. Any thoughts or input is much appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
Hi @TKGC - right now, you could manually set the origin of the entry using something like this: Logger.info('hello, world').getLogEntryEvent().OriginLocation__c = 'some value'; Essentially, whatever value you set on the platform event's field A couple of follow up questions for you though, as I'm curious about your use case:
|
Beta Was this translation helpful? Give feedback.
Hi @TKGC - right now, you could manually set the origin of the entry using something like this:
Essentially, whatever value you set on the platform event's field
OriginLocation__c
is ultimately what's stored inLogEntry__c.OriginLocation__c
(which is used in the formula fieldLogEntry__c.Origin__c
). I don't think this approach is ideal, as you would need to add additional logic to fully handle parsing a stack trace (which is something Nebula Logger already does internally), but it's something you could implement today. However, I already have some internal logic built to skip some classes when setting the field