如何详细跟踪超薄应用程序错误 [英] How to Have a Detailed Trace of a Slim Application Error

查看:15
本文介绍了如何详细跟踪超薄应用程序错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有10000行代码,概述了使用Slim框架实现的API的路线。但是,我收到错误消息preg_match(): Compilation failed: two named subpatterns have the same name at offset 89。问题是,我在Slim Route.php获得了引用preg_match('/cost-centers...', '/overview/funds...', NULL)语句的堆栈跟踪。现在我的URL很长,我无法确定哪些URL具有相同的名称。

有没有办法获得更详细的堆栈跟踪,而不是显示这些缩写格式?

推荐答案

感谢mgansler的这篇技巧。

我刚刚使用了custom error handler和PHPException::getTrace()函数。我还关闭了Slim的默认调试,以确保调用自定义错误处理程序。

代码如下:

$app = new SlimSlim(array(
    'debug' => false
));
$app->error(function (Exception $e) use ($app) {
    //enter manipulation of $e->getTrace()
    //or just var_dump($e->getTrace()) but the format would be chaotic
});

这篇关于如何详细跟踪超薄应用程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆