输出“Watch”的值 在 Eclipse 中写入日志文件

发布于 2024-07-09 21:11:09 字数 221 浏览 10 评论 0原文

我有一段无法编辑的 Java 代码,但我想调试它。

问题是我的 10,000 条记录中有一条存在数据错误,导致应用程序崩溃。

我可以远程调试实时应用程序并添加监视,该监视将在处理每个记录时获取记录的 ID。 问题是,当处理“坏记录”并且退出该方法时,手表中保存的值会丢失,因此我不知道是哪个记录导致了问题。

有什么方法可以存储/打印手表中的值

谢谢

I have a piece of Java code I can't edit which I want to debug.

The issue is that one of my 10,000 records has a data error and is causing the application to crash.

I can remote debug the live application and add watch which would pick up the id of the record as each is processed. The problem is when the "bad record" is processed and the method is exited the value held in the watch is lost so I don't know which record it was that causes the problem.

Is there any way of storing/printing the value held in the watch

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

横笛休吹塞上声 2024-07-16 21:11:09

如果错误记录通过引发异常导致应用程序崩溃,请尝试在该异常上放置断点,也许记录信息在该方法的堆栈帧中仍然可用。 没试过这个,只是一个想法。 祝你好运。

If the bad record is causing your application to crash by throwing an exception, try putting a breakpoint on that exception, and maybe the record info will still be available in the stack frame of that method. Haven't tried this, just a thought. Good luck.

岁月蹉跎了容颜 2024-07-16 21:11:09

也许你可以使用 watchExpressionDelegates 扩展点 在其中。

您将实现该委托类 org.eclipse.jdt.internal.debug.ui.JavaWatchExpressionDelegate 的类可能有机会做任何它想做的事情,包括记录信息。

我还没有测试过它,但如果您成功实现了它,请告诉我们。

May be yu could launch your own modified eclipse with a watchExpressionDelegates extension point in it.

Your class which would implement that delegate class org.eclipse.jdt.internal.debug.ui.JavaWatchExpressionDelegate may have the opportunity to do whatever it wants, including logging informations.

I have not tested it but if you do successfully implement that, let us know.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文