How to log Set and Map #221
Answered
by
jongpie
mmakara2021
asked this question in
Q&A
-
Hello curently I was not able to figure out how to log Set and Map in apex code. thanks |
Beta Was this translation helpful? Give feedback.
Answered by
jongpie
Oct 8, 2021
Replies: 1 comment 2 replies
-
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 // 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 list', new List<SObject>(someRecordMap?.keySet())); |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
mmakara2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 forSet<SObject>
andMap<Id, SObject>
in a future release - in the meantime, you can try these workarounds: