如何通过 xdebug 中的 api 调用获取堆栈跟踪?
我们正在使用xdebug,并且跟踪的工作方式与广告在代码执行期间一样。
function someGetUsersHelper() {
xdebug_start_trace();
[SOME CODE HERE]
xdebug_stop_trace();
}
但是,如果页面/脚本是通过加载来执行的,它只会跟踪代码的包装部分通过请求在浏览器中显示完整页面
index.php
但是当我们通过 api 调用来调用该函数时,跟踪不起作用
index.php?api=getUsers
即使相同的函数成功执行,它也不会跟踪。
附加说明:如果从 phpunit 测试用例调用该函数或者我们在 php.ini 中设置 xdebug.auto_trace = 1,则跟踪也可以工作,但这会给我们留下一个非常长、混乱的跟踪文件。
所以问题是这样的:
- 这可能是什么问题/原因以及我们如何设法获得 想要通过 api 调用进行清晰简洁的跟踪吗?
多谢!!
We are using xdebug and the tracing works as advertised during code execution via..
function someGetUsersHelper() {
xdebug_start_trace();
[SOME CODE HERE]
xdebug_stop_trace();
}
It however only traces the wrapped part of the code if the page/script is executed via loading the full page in the browser via requesting
index.php
But tracing does not work, when we call the function as an api call via
index.php?api=getUsers
Even though the very same function is executed successfully it does not trace.
As an additional note: Tracing also works if the function is called from phpunit testcases or if we set xdebug.auto_trace = 1 in the php.ini, but that leaves us with a very long, messed up trace file.
So the question is this:
- What might be the issue/reason for this and how can we manage to get the
desired clear and succinct trace via api call?
Thanks a lot!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法说出为什么跟踪不起作用。但是您可以尝试以下操作:
xdebug.trace_enable_trigger=1
XDEBUG_TRACE
作为 POST/GET 参数或作为 cookie 来启动 xdebug还有一个名为 Easy XDebug 的 Firefox 插件来设置标志
I could not say why the trace is not working. But you could try this:
xdebug.trace_enable_trigger=1
in your php configurationXDEBUG_TRACE
as POST/GET Parameter or as a cookieThere is also a Firefox Plugin called Easy XDebug to set the flags