Eclipse Breakpoint System.out

eclipse, java

Solution

You have to make it a conditional breakpoint with a following condition:

System.out.printf(Thread.currentThread().getStackTrace()[1].getMethodName() + "\n") == null

Works fine in my Eclipse. I'm using printf to make printing code evaluate to boolean. Not sure if there's a way to automate inserting this code into a breakpoint.

Problem

typically I set a breakpoint in my Java application when I want to observe the run. However sometimes I just want to know if a method is called or not. Therefore a breakpoint does not help me, and I insert a "systrace" statement `System.out.println("method signature");` I thought it would be a nice feature If I could set a breakpoint and when the breakpoint is reached to just print out the systrace message and continue the run. Do you know if this is possible?

Original source