简体   繁体   中英

Eclipse Breakpoint System.out

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM