Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony2 500错误,但没有日志_Symfony_Logging_Controller_Show - Fatal编程技术网

Symfony2 500错误,但没有日志

Symfony2 500错误,但没有日志,symfony,logging,controller,show,Symfony,Logging,Controller,Show,我有一个“RealizationAwardScategory”实体。当我想要保持这个对象时,一切都会完美地工作。表单正常,视图显示正确,数据库保存正常。但是,当我想在“显示”、“编辑”或“索引”视图中查看此实体时,我有一个带有500错误的空白页,但没有日志。我试图在apacheerrors.log和app/logs/prod.log中看到它(我在prod env中,但我试图在dev.log中看到它) 这是我的实体: <?php namespace VisualImmersion\Admi

我有一个“RealizationAwardScategory”实体。当我想要保持这个对象时,一切都会完美地工作。表单正常,视图显示正确,数据库保存正常。但是,当我想在“显示”、“编辑”或“索引”视图中查看此实体时,我有一个带有500错误的空白页,但没有日志。我试图在apacheerrors.log和app/logs/prod.log中看到它(我在prod env中,但我试图在dev.log中看到它)

这是我的实体:

<?php

namespace VisualImmersion\AdminBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * RealisationAwardsCategory
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="VisualImmersion\AdminBundle\Entity\Repository\RealisationAwardsCategoryRepository")
 */
class RealisationAwardsCategory
{
    /**
     * @var integer
     *
     * @ORM\Column(name="ID", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;


    /**
     * @ORM\ManyToMany(targetEntity="RealisationAwards", mappedBy="RealisationAwardsCategories")
     */
    private $awards;


    public function __construct()
    {
        $this->awards = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return RealisationAwardsCategory
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Add Awards
     *
     * @param \VisualImmersion\AdminBundle\Entity\RealisationAwards $awards
     */
    public function addAwards(\VisualImmersion\AdminBundle\Entity\RealisationAwards $awards)
    {
        $this->awards[] = $awards;
    }

    /**
     * Get Awards
     *
     * @return \Doctrine\Common\Collections\ArrayCollection()
     */
    public function getAwards()
    {
        return $this->awards->toArray();
    }

    /**
     * Remove awards
     *
     * @param \VisualImmersion\AdminBundle\Entity\RealisationAwards $awards
     */
    public function removeAwards(\VisualImmersion\AdminBundle\Entity\RealisationAwards $awards)
    {
        $this->awards->removeElement($awards);
    }
}
我的路线:

realisationawardscategory_index:
    path:  /realisationawardscategory
    defaults: { _controller: VisualImmersionAdminBundle:RealisationAwardsCategory:index }

realisationawardscategory_show:
    path:  /realisationawardscategory/{id}
    defaults: { _controller: VisualImmersionAdminBundle:RealisationAwardsCategory:show }
    requirements:
      id: \d+

realisationawardscategory_new:
    path:  /realisationawardscategory/new
    defaults: { _controller: VisualImmersionAdminBundle:RealisationAwardsCategory:new }

realisationawardscategory_create:
    path:  /realisationawardscategory/create
    defaults: { _controller: VisualImmersionAdminBundle:RealisationAwardsCategory:create }
    requirements:


realisationawardscategory_edit:
    path:  /realisationawardscategory/edit/{id}
    defaults: { _controller: VisualImmersionAdminBundle:RealisationAwardsCategory:edit }
    requirements:
      id: \d+

realisationawardscategory_update:
    path:  /realisationawardscategory/update/{id}
    defaults: { _controller: VisualImmersionAdminBundle:RealisationAwardsCategory:update }
    requirements:
      id: \d+

realisationawardscategory_delete:
    path:  /realisationawardscategory/delete/{id}
    defaults: { _controller: VisualImmersionAdminBundle:RealisationAwardsCategory:delete }
    requirements:
      id: \d+
我尝试使用monolog强制在日志中显示实体,如下所示:

{% extends 'VisualImmersionAdminBundle::layout.html.twig' %}

{% block body -%}
    <h1>Realisation Awards Category</h1>

    <table class="record_properties">
        <tbody>
            <tr>
                <th>Name</th>
                <td>{{ entity.name }}</td>
            </tr>
        </tbody>
    </table>

        <ul class="record_actions">
    <li>
        <a href="{{ path('realisationawardscategory_index') }}">
            Back to the list
        </a>
    </li>
    <li>
        <a href="{{ path('realisationawardscategory_edit', { 'id': entity.id }) }}">
            Edit
        </a>
    </li>
            <li>
                <form action="{{ path('realisationawardscategory_delete', { 'id': entity.id }) }}" method="post">
                    <input type="hidden" name="_method" value="DELETE" />
                    {{ form_widget(delete_form) }}
                    <button type="submit">Delete</button>
                </form>
            </li>
</ul>
{% endblock %}
$logger = $this->get('logger');
$logger->error('entity' . $entity);
但什么也没显示出来

首先,我想知道显示中的错误是什么,以及为什么不显示日志


谢谢您的帮助:)

您是否为控制器内的所有路由指定了公共前缀

/**
 * @Route("/realisationawardscategory")
 */
class <<your controller's name >> extends Controller {
 /**
     * Finds and displays a RealisationAwardsCategory entity.
     *
     * @Route("/{id}", name="realisationawardscategory_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        << your code >>
    }
}// end of controller..
/**
*@Route(“/realizationawardscategory”)
*/
班
/**
 * @Route("/realisationawardscategory")
 */
class <<your controller's name >> extends Controller {
 /**
     * Finds and displays a RealisationAwardsCategory entity.
     *
     * @Route("/{id}", name="realisationawardscategory_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        << your code >>
    }
}// end of controller..