Php symfony2如何打印服务器&x27;什么地方有虫子

Php symfony2如何打印服务器&x27;什么地方有虫子,php,symfony,Php,Symfony,我正在运行一个PHP服务器。它的工作原理类似于API(接收http请求并向我的前端发送http响应)。 我使用symfony2来帮助我发展 我的问题是当我的前端请求后端时(因此PHP服务器)。API错误,发送http 500错误,但不显示错误消息。所以我找不到错误 我使用PhpStorm编写代码 我使用php应用程序/控制台服务器启动服务器:run--env=dev 有人知道如何在某个地方(例如在控制台或文件中)打印服务器的错误吗 来自前端的请求:POSThttp://127.0.0.1:800

我正在运行一个PHP服务器。它的工作原理类似于API(接收http请求并向我的前端发送http响应)。 我使用symfony2来帮助我发展

我的问题是当我的前端请求后端时(因此PHP服务器)。API错误,发送http 500错误,但不显示错误消息。所以我找不到错误

我使用PhpStorm编写代码

我使用
php应用程序/控制台服务器启动服务器:run--env=dev

有人知道如何在某个地方(例如在控制台或文件中)打印服务器的错误吗

来自前端的请求:
POSThttp://127.0.0.1:8000/api/kernel/user

在后端使用请求的函数`

public function postPersist(User $user, LifecycleEventArgs $event)
    {
        $user->setFullName($user->getFirstName() . ' ' . $user->getLastName());
        $userPositions = $user->getPositions();
        if (isset($userPositions)) {
            foreach ($userPositions as $userPosition) {
                if ($userPosition->isMain()) {
                    $user->setMainPosition($userPosition->getPosition());
                    break;
                }
            }
        }
        $this->setMemberships($user);
        try {
            $this->myFunction($user);//This function has a error. I want to see this error. If I commente this line, it works, so the error come from this function
        }catch(Exception $exception){
            print ($exception->getMessage());
        }
    }`

symfony服务器的日志位于/app/logs/dev.log

是否使用try/catch?如果是这样,异常将通过$Exception->getMessage()实现这一点。我使用try/catch,但是,当我编写
try{$this->nameFunction();}catch(异常$Exception){print($Exception->getMessage());}
时,我的控制台中没有消息。我想我们需要查看一些代码。这太模糊了。还要检查服务器错误日志。您知道服务器错误日志在哪里吗?取决于操作系统和服务器,假设Apache、Fedora系列是/var/log/httpd/error.log,Debian系列应该是/var/log/apache2/error\u log