在我使用的Laravel 5.6版本中,用于日志记录的配置文件是config/logging.php
在那里,您将找到以下部分
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
...
]
更改行
'channels' => ['single'],
到
'channels' => ['daily'],
然后它会像这样:
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
...
]
它将在日志目录中以laravel-2018-08-13.log
格式为每天创建日志文件。日志目录将像这样
以前
应用轮换配置后,目录具有为当前日期创建的日志文件(如为今天创建的圈形文件 2018-08-13)。