我可以使用eclipse调试器将变量写入文件

问题描述 投票:1回答:1

是否有可能在eclipse中创建某种“跟踪断点”,当命中“断点”而不暂停应用程序时,Eclipse会将我选择的变量记录到文件中?

eclipse debugging
1个回答
2
投票

当然。对于此示例方法:

public static void logArgs(final String one, final String two) {
    System.out.println(one + two);
}

将断点放入其中,右键单击它并编辑Breakpoint properties...,如示例所示。重要的复选框是ConditionalSuspend when 'true'。只需返回false,以便断点根本不会暂停。

java.io.FileWriter w = new java.io.FileWriter("/tmp/file.txt", true);
w.write(String.format("args(%s, %s)%n"), one, two));
w.close();
return false;

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.