Java 有功能级调试/日志记录工具吗?
如果标题令人困惑,我很抱歉,但我想不出类似的东西来称呼它。我正在寻找的是是否有任何类型的工具(或 Eclipse 插件等)可以记录程序中所有翻译的行。例如:
int b = 20;
for (int x = 0; x < z; x++)
b = b + 5;
会被翻译成
b = 20
for (int x = 0; 0 < 50; 0++)
b = 20 + 5;
“我问”,因为相对来说实现起来似乎并不太困难,因为我们可以一次调试一行,我认为这会节省大量时间。如果您可以浏览日志文件并查找错误并准确检查问题发生在哪一行以及导致问题的上下文,那么调试会容易得多。 XDebug for PHP 具有函数级别跟踪,因此您可以查看程序中传递的变量的值,并将其转储到日志中。我发现它节省了我大量的调试时间。那时的问题通常很明显并且很容易解决。
它肯定会比添加日志语句更好。
编辑:我想澄清一下,我并不是在寻找 Eclipse 风格的传统调试器。我只是在寻找变量和状态的整体记录。
I'm sorry if the title is confusing but I couldn't think of anything similar to call it. What I'm looking for is if there is any sort of tool (or eclipse plugin, etc) that will log all the translated lines from a program. For example:
int b = 20;
for (int x = 0; x < z; x++)
b = b + 5;
Would get translated into
b = 20
for (int x = 0; 0 < 50; 0++)
b = 20 + 5;
I ask because it seems it wouldn't be too difficult to implement relatively, since we can debug one line at a time and I think it would save an enormous amount of time. If you could just go through a log file and look for your error and check out exactly what line the problem occurred on and the context that caused it then debugging would be a lot easier. XDebug for PHP has function level traces so you can see the value of the variables passed in your program, and have that dumped to a log. I found that it saved me a large amount of debugging time. The problems were usually obvious and easy to fix then.
It would sure beat adding logging statements.
EDIT: I want to clarify that I am not looking for a traditional debugger ala Eclipse style. I'm simply looking for a overall logging of the variables and states.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不明白这样的工具如何工作。它对条件语句有什么作用?用于用户输入?
另外,听起来有点像任何此类工具都可以用来解决停止问题.. .只要看最后一行。
I don't understand how such a tool would work. What would it do for conditionals? For user input?
Also, it sounds a bit like any such tool could be used to solve the Halting Problem...just look at the last line.
Eclipse 和任何有价值的 IDE 都附带一个调试器,可以执行此操作以及更多操作。您可以让程序在任何特定的代码行处停止(无论何时到达,或者仅当满足特定条件时),并检查该点变量的状态,以及修改变量并执行任意代码,而不是打印出跟踪信息语句来查看它们的返回值。
对于代码在服务器上运行的 Web 应用程序,您甚至可以通过网络将调试器连接到远程 JVM。
这里有一个关于如何使用 Eclipse 调试器的教程。甚至还有一个插件允许您将其用于 PHP 代码。
Eclipse and any IDE worth its salt comes with a debugger that can do this and much more. Rather than print out traces, you can have the program halt at any specific line of code (whenever it is reached, or only when specific conditions are met) and inspect the state of variables at that point, as well as modify variables and execute arbitrary statements to see their return value.
For web applications where the code is running on a server, you can even connect the debugger via the network to a remote JVM.
Here's a tutorial on how to use the eclipse debugger. There's even a plugin that allows you to use it for PHP code.
我认为 Trace 可能是你想要的,尽管在实践中,我希望具有表达式求值和条件断点的良好调试器可以更快地解决您的整体问题。请注意,Trace 已写入 JPDA,并且其代码可用。
I think Trace may be what you want, although in practice, I would expect a good debugger with expression evaluation and conditional breakpoints might solve your overall problem more quickly. Note that Trace is written to the JPDA and its code is available.