Skip to content

How to log Set and Map #221

Answered by jongpie
mmakara2021 asked this question in Q&A
Oct 7, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @mmakara2021 - great question, unfortunately there is not currently a built-in way to log Set and Map. In v4.3.0, I added support for List<SObject>, but I still have not implemented support for Set or Map yet. I've created issue #222 to add this functionality for Set<SObject> and Map<Id, SObject> in a future release - in the meantime, you can try these workarounds:

// Workaround for logging a Set<SObject>
Set<SObject> someRecordSet = new Set<SObject>();
Logger.info('logging a set by converting to a list', new List<SObject>(someRecordSet));

// Workaround for logging a Map<Id, SObject>
Map<Id, SObject> someRecordMap = new Map<Id, SObject>();
Logger.info('logging a set by converting to a…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mmakara2021
Comment options

@jongpie
Comment options

Answer selected by mmakara2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Logging Source: Apex Items related to using Logger within Apex Layer: Logger Engine Items related to the core logging engine
2 participants