【问题标题】:Symfony on Heroku produces 500 Internal server error but there isn't the messageHeroku 上的 Symfony 产生 500 Internal server error 但没有消息
【发布时间】:2015-11-30 16:35:30
【问题描述】:

正如我在标题中所说,该应用程序产生 500 内部服务器错误,但在日志中没有错误,所以我不知道如何理解发生了什么。

这是日志:

2015-11-30T16:31:50.881209+00:00 heroku[router]: at=info method=GET path="/" host=myapp.herokuapp.com request_id=52d75ec4-3345-4d3c-88e6-a5f08c366dc2 fwd="151.77.121.140" dyno=web.1 connect=0ms service=10ms status=500 bytes=765
2015-11-30T16:31:50.882326+00:00 app[web.1]: 10.76.13.112 - - [30/Nov/2015:16:31:50 +0000] "GET / HTTP/1.1" 500 495 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36
2015-11-30T16:31:51.618891+00:00 app[web.1]: 10.76.13.112 - - [30/Nov/2015:16:31:51 +0000] "GET /favicon.ico HTTP/1.1" 200 5430 "https://myapp.herokuapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36
2015-11-30T16:31:51.617820+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=cf2ecf03-65ee-4213-8d52-a7eaaa24ac76 fwd="151.77.121.140" dyno=web.1 connect=0ms service=1ms status=200 bytes=5696

我如何知道生成应用程序的错误类型以便我修复它?

【问题讨论】:

    标签: symfony heroku internal-server-error


    【解决方案1】:

    解决了。要查看应用程序产生的错误,必须将 Symfony 配置为与 Heroku 使用的临时系统兼容。

    所以在config_prod.yml 中设置monolog 写入php://stderr

    monolog:
        handlers:
            main:
                type:         fingers_crossed
                action_level: error
                handler:      nested
            nested:
                type:  stream
                # Required by Heroku ephemeral filesystem
                path:  "php://stderr"
                level: debug
            console:
                type:  console
    

    有关如何在 Heroku 上为 Symfony 应用程序配置日志记录的更多信息可以在他们的help pages 上找到。

    PS

    错误是一个简单的拼写错误:写成default/index.html.twig 而不是Default/index.html.twig。是大写字母和git提交的问题。非常简单,但是很繁琐,很难找到!

    【讨论】:

      猜你喜欢
      • 2020-02-01
      • 2013-03-13
      • 1970-01-01
      • 2018-01-17
      • 2023-03-30
      • 2014-06-22
      • 1970-01-01
      • 2015-08-16
      • 2022-12-08
      相关资源
      最近更新 更多