Noam Musk
Noam Musk

Reputation: 87

IntelliJ debugging - How to watch a variable throughout its lifecycle?

I'm working on a SpringBoot like service, and using IntelliJ idea. There are some objects that are instantiated at service startup and undergo numerous method calls in multiple classes throughout the lifecycle of each API call.

With IntelliJ's debugging features, I can watch such a variable at any breakpoint, but is there a way to follow a variable's journey as it's passed around and watch all state mutations and method calls happening to it?

Upvotes: 6

Views: 9716

Answers (2)

kissLife
kissLife

Reputation: 327

You can use Make Object ID to track the object values.

Or use data breakpoint to monitor the variable changes.

Upvotes: 1

Egor
Egor

Reputation: 2674

You can try using field watchpoints, see https://www.jetbrains.com/help/idea/using-breakpoints.html. It allows to stop where the field is accessed and/or modified:

enter image description here

Upvotes: 6

Related Questions