laravel-log日志分文件存储

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/PerfectUrl/article/details/85161862

1.打开config文件夹的logging.php 文件,日志配置文件

2.在channels 数组中自定义一个事件驱动

'request_response' => [
            'driver' => 'daily',
            'path' => storage_path('logs/request_response.log'),
            'level' =>  env('APP_LOG_LEVEL', 'debug'),
        ],

3.在需要写日志的位置直接 \Illuminate\Support\Facades\Log::channel("request_response")->info("测试");

channel方法中传入要生成的文件驱动就可以了。

猜你喜欢

转载自blog.csdn.net/PerfectUrl/article/details/85161862