使用laravel指定日志文件记录任意日志
时间:2020-10-05 21:33:18|栏目:PHP代码|点击: 次
如下所示:
(new Logger('邮件发送失败')) ->pushHandler(new RotatingFileHandler(storage_path('logs/email_send.log'))) ->info(json_encode([ 'data' => $notifiable, 'error' => $e->getMessage() ],320));
实际效果如下:
方式二:
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); }
上一篇:php创建无限级树型菜单
栏 目:PHP代码
下一篇:Discuz7.2版的faq.php SQL注入漏洞分析
本文地址:http://www.codeinn.net/misctech/7188.html