Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

.logObject() method in java


When I use logObject() in java for an object that contains other objects as fields, I can see in SmartInspect only classname and pointer of the field (probably .toString() method). Is there any way to traverse fields-classes ?

best regards
Piotr Rezmer


Hello Piotr,

logObject does currently not recursively log the objects fields. It handles fields such as arrays, dictionaries, primitives such as string or int but for objects it simply calls its toString() method. Adding recursion support to the logObject method (and adding a Tree viewer in the Console) is already on our feature request list. It has been requested quite a few times so far so it has a good chance to get implemented. In the meantime, as a workaround, you can always call the logObject method for the object fields directly.