user1779715
user1779715

Reputation:

Can I set more than one breakpoint on the same line in IntelliJ?

I would like to add two breakpoints on the same line in IntelliJ: one always logs a message, and the other suspends the program if a certain condition is true.

Is this somehow possible to do in IntelliJ?

Upvotes: 1

Views: 754

Answers (2)

Egor
Egor

Reputation: 2664

There's no way to have two breakpoints on the same line currently. A workaround - log and check inside breakpoint condition: here we log depth on every hit, but stop only if depth % 10 == 0

enter image description here

Upvotes: 2

streetturtle
streetturtle

Reputation: 5850

Yes, it's possible.
Right click on breakpoint and then click More, or by shortcut: Ctrl + Shift + F8 which opens Breakpoints dialog where you need to set up following options:

  • Condition
  • Evaluate and log

enter image description here

Upvotes: -1

Related Questions