如下所示:
1
2
3
4
5
6
|
( new Logger( '邮件发送失败' ))
->pushHandler( new RotatingFileHandler(storage_path( 'logs/email_send.log' )))
->info(json_encode([
'data' => $notifiable ,
'error' => $e ->getMessage()
],320));
|
实际效果如下:
方式二:
1
2
3
4
5
6
7
8
9
10
11
|
use Log;
...
public function testLog()
{
$customer_id = 111;
$code = 333;
Log::getMonolog()->popHandler();
Log::useFiles(storage_path( 'logs/data_info_market.log' ), 'info' );
Log::info( '==>id=' . $customer_id . ',code=' . $code );
}
|
以上这篇使用laravel指定日志文件记录任意日志就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/zhezhebie/article/details/88012504