N K*_*lgi 3 php symfony monolog
在 Symfony 3 中,无论如何我可以在不设置调试模式的情况下将所有错误写入生产日志?错误将包括 http 500 错误或应用程序错误或 php 错误,这些错误是由于在生产中将错误标志设置为 false 而被静音的。
生产的当前日志配置是
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: info
channels: [!request, !event, !translation, !kernel, !security, !php, !snc_redis]
php:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%_php.log"
level: warning
channels: [php]
Run Code Online (Sandbox Code Playgroud)
您可以为此使用默认的生产设置(取自monolog-bundle 配方):
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_404s:
# regex: exclude all 404 errors from the logs
- ^/
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
Run Code Online (Sandbox Code Playgroud)
这种配置发生的情况是 Monolog 在请求期间缓冲所有消息,但仅在出现错误时将它们写入日志。这样你就不会一直用嘈杂的调试和信息消息“淹没”你的日志。只有在请求期间出现错误时,您才会获得完整的日志信息。
| 归档时间: |
|
| 查看次数: |
6267 次 |
| 最近记录: |