swoft icon indicating copy to clipboard operation
swoft copied to clipboard

swoft在sgo中使用Log::info出现异常:上下文丢失

Open NYYYL opened this issue 4 years ago • 0 comments

Q A
Bug report? yes
Feature request? yes
Swoft version 2.0.10
Swoole version 4.5.7
PHP version 7.3.1
Runtime environment CentOS 7

Describe the bug [ERROR] Coroutine internal error: context information has been lost of the coID: 19 At File /data/wwwroot/query/vendor/swoft/framework/src/Context/Context.php line 58 Trace: #0 /data/wwwroot/query/vendor/swoft/framework/src/Helper/Functions.php(160): Swoft\Context\Context::get(true) #1 /data/wwwroot/query/vendor/swoft/log/src/Logger.php(233): context() #2 /data/wwwroot/query/vendor/swoft/log/src/Logger.php(191): Swoft\Log\Logger->formatRecord('trace[QueryLogi...', Array, 200, 'info', Object(DateTime), Array) #3 /data/wwwroot/query/vendor/monolog/monolog/src/Monolog/Logger.php(642): Swoft\Log\Logger->addRecord(200, 'trace[QueryLogi...', Array) #4 /data/wwwroot/query/vendor/swoft/log/src/Helper/Log.php(72): Monolog\Logger->info('11111', Array) #5 /data/wwwroot/query/app/Model/Logic/QueryLogic.php(86): Swoft\Log\Helper\Log::info('11111') #6 /data/wwwroot/query/vendor/swoft/stdlib/src/Helper/PhpHelper.php(58): App\Model\Logic\QueryLogic->App\Model\Logic{closure}() #7 /data/wwwroot/query/vendor/swoft/framework/src/Co.php(125): Swoft\Stdlib\Helper\PhpHelper::call(Object(Closure)) #8 {main}

sgo(function () use ($chan, $fd, $data, $config, $message, $type) {
      switch ($type) {
          case 'query':
              Log::info('11111');
              break;
          default:
              break;
      }
  }, false);

NYYYL avatar Nov 15 '21 08:11 NYYYL