mel*_*rte 3 debugging logging laravel laravel-blade log-level
如果我编写一些带有弃用通知的 PHP 代码,它会显示在本地环境中。
示例:index.php
<?php
function super(string $test='', string $essai)
{
return 'toto';
}
super('sy', 1);
exit;
Run Code Online (Sandbox Code Playgroud)
显示:
Deprecated: Optional parameter $test declared before required parameter $essai is implicitly treated as a required parameter in /var/www/public/index.php on line 9
Run Code Online (Sandbox Code Playgroud)
这很好。
但是 Laravel 控制器中的完全相同的代码不会显示,并且不会存储在任何日志文件中。我将配置 app.env 设置为“local”,将 app.debug 设置为 true,将 app.log_level 设置为“debug”。知道我缺少什么吗?
根据文档:
记录弃用警告
PHP、Laravel 和其他库经常通知其用户,它们的某些功能已被弃用,并将在未来版本中删除。如果您想记录这些弃用警告,您可以
deprecations在应用程序的config/logging.php配置文件中指定您的首选日志通道:Run Code Online (Sandbox Code Playgroud)'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 'channels' => [ ... ]或者,您可以定义一个名为 deprecations 的日志通道。如果存在具有此名称的日志通道,它将始终用于记录弃用:
Run Code Online (Sandbox Code Playgroud)'channels' => [ 'deprecations' => [ 'driver' => 'single', 'path' => storage_path('logs/php-deprecation-warnings.log'), ], ],
| 归档时间: |
|
| 查看次数: |
3170 次 |
| 最近记录: |