我使用webman并開啟協(xié)程(Workerman\Events\Swoole::class),我現(xiàn)在模擬并發(fā)請求100次test,按正常來說,我的log2日志文件應(yīng)該有100次【請求進(jìn)來】的日志,但我發(fā)現(xiàn)記錄一部分后會提示log2.WARNING: A possible infinite logging loop was detected and aborted. It appears some of your handler code is triggering logging, see the previous log record for a hint as to what may be the cause. [] [],請問為何呢
<?php
namespace app\controller;
use support\Request;
use support\Log;
class IndexController
{
public function test(Request $request){
$log = Log::channel('log2');
sleep(3);
$log->info('請求進(jìn)來');
return json(array('ok2'));
}
}
#config下的log配置
return [
// log2通道
'log2' => [
// 處理默認(rèn)通道的handler,可以設(shè)置多個
'handlers' => [
[
// handler類的名字
'class' => Monolog\Handler\RotatingFileHandler::class,
// handler類的構(gòu)造函數(shù)參數(shù)
'constructor' => [
runtime_path() . '/logs/log2.log',
Monolog\Logger::DEBUG,
],
// 格式相關(guān)
'formatter' => [
// 格式化處理類的名字
'class' => Monolog\Formatter\LineFormatter::class,
// 格式化處理類的構(gòu)造函數(shù)參數(shù)
'constructor' => [ null, 'Y-m-d H:i:s', true],
],
]
],
],
];