日志通道创建
问题 :
//新增用于记录wifi数据获取
'wifiLog' => [
'driver' => 'single',
'name' => 'Grab Wifi Data',
'path' => storage_path('logs/wifi.log'),
'level' => 'debug',
],
//新增用于记录message数据获取
'messageLog' => [
'driver' => 'single',
'name' => 'Grab message Data',
'path' => storage_path('logs/message.log'),
'level' => 'debug',
]
如上:
在日志通道配置文件logging.php中创建了两个日志通道。
其中都指明了存储路径,但是在实际使用中,只有第一个wifiLog通道成功可以使用,第二个通道messageLog通道,在使用时会将要存储的日志记录到logs/laravel.log中
大致内容如下 :
[2020-05-20 17:02:39] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [messageLog] is not defined.
该问题已解决
清理config缓存后就可以使用了
laravel修改配置后一定要清理缓存
命令行进入laravel根目录,清理缓存命令如下 :
php artisan config:clear
存在问题,及解决
此处在清缓存是存在一个问题 : 清除缓存的同时清楚了redis的数据,可能造成一些必要数据的丢失,所以建议大家在操作清除缓存之前之前,需要进行一些配置,访问下方链接查看如何配置
Laravel 下配置 Redis 让缓存、Session 各自使用不同的 Redis 数据库
推荐文章: