安装了webman/log 插件后,当出现异常信息的时候,错误日志重复记录

silently

bug描述

按照webman/admin 手册的安装步骤完成安装后,又安装了webman/log日志记录SQL
但是当出现一些异常信息的时候,错误日志重复记录

程序代码或配置

<?php

namespace app\controller;

use plugin\admin\app\model\Role;
use support\Request;

class IndexController
{
    public function index(Request $request)
    {
        return response('hello webman');
    }

    public function view(Request $request)
    {
        return view('index/view', ['name' => 'webman']);
    }

    public function json(Request $request)
    {
        $list = Roles::get();
        return json(['code' => 0, 'msg' => 'ok','data'=>$list]);
    }

}

期待的结果及实际结果

期待error异常只记录一次,而不是两次

[2022-12-11 15:42:50] default.ERROR: 127.0.0.1 GET 127.0.0.1:8787/json
Error: Class "app\controller\Roles" not found in D:\www\webman\app\controller\IndexController.php:22
Stack trace:
#0 D:\www\webman\vendor\workerman\webman-framework\src\App.php(284): app\controller\IndexController->json()
#1 D:\www\webman\vendor\workerman\webman-framework\src\App.php(304): Webman\App::Webman\{closure}()
#2 D:\www\webman\vendor\webman\log\src\Middleware.php(58): Webman\App::Webman\{closure}()
#3 D:\www\webman\vendor\workerman\webman-framework\src\App.php(299): Webman\Log\Middleware->process()
#4 D:\www\webman\vendor\workerman\webman-framework\src\App.php(147): Webman\App::Webman\{closure}()
#5 D:\www\webman\vendor\workerman\workerman\Connection\TcpConnection.php(638): Webman\App->onMessage()
#6 D:\www\webman\vendor\workerman\workerman\Events\Select.php(311): Workerman\Connection\TcpConnection->baseRead()
#7 D:\www\webman\vendor\workerman\workerman\Worker.php(2467): Workerman\Events\Select->loop()
#8 D:\www\webman\vendor\workerman\workerman\Worker.php(1453): Workerman\Worker->run()
#9 D:\www\webman\vendor\workerman\workerman\Worker.php(1396): Workerman\Worker::forkWorkersForWindows()
#10 D:\www\webman\vendor\workerman\workerman\Worker.php(560): Workerman\Worker::forkWorkers()
#11 D:\www\webman\vendor\workerman\webman-framework\src\support\App.php(124): Workerman\Worker::runAll()
#12 D:\www\webman\start.php(4): support\App::run()
#13 {main} [] []
[2022-12-11 15:42:50] default.ERROR: 127.0.0.1 GET 127.0.0.1:8787/json [4.37092ms] [webman/log]
Error: Class "app\controller\Roles" not found in D:\www\webman\app\controller\IndexController.php:22
Stack trace:
#0 D:\www\webman\vendor\workerman\webman-framework\src\App.php(284): app\controller\IndexController->json()
#1 D:\www\webman\vendor\workerman\webman-framework\src\App.php(304): Webman\App::Webman\{closure}()
#2 D:\www\webman\vendor\webman\log\src\Middleware.php(58): Webman\App::Webman\{closure}()
#3 D:\www\webman\vendor\workerman\webman-framework\src\App.php(299): Webman\Log\Middleware->process()
#4 D:\www\webman\vendor\workerman\webman-framework\src\App.php(147): Webman\App::Webman\{closure}()
#5 D:\www\webman\vendor\workerman\workerman\Connection\TcpConnection.php(638): Webman\App->onMessage()
#6 D:\www\webman\vendor\workerman\workerman\Events\Select.php(311): Workerman\Connection\TcpConnection->baseRead()
#7 D:\www\webman\vendor\workerman\workerman\Worker.php(2467): Workerman\Events\Select->loop()
#8 D:\www\webman\vendor\workerman\workerman\Worker.php(1453): Workerman\Worker->run()
#9 D:\www\webman\vendor\workerman\workerman\Worker.php(1396): Workerman\Worker::forkWorkersForWindows()
#10 D:\www\webman\vendor\workerman\workerman\Worker.php(560): Workerman\Worker::forkWorkers()
#11 D:\www\webman\vendor\workerman\webman-framework\src\support\App.php(124): Workerman\Worker::runAll()
#12 D:\www\webman\start.php(4): support\App::run()
#13 {main}
 [] []

重现bug的步骤

随便写一点异常

系统环境及workerman/webman等具体版本

windows10
截图

1192 1 0
1个回答

walkor 打赏

webman/log 插件不会影响webman内核的日志功能。当业务产生异常时,内核也会记录一条日志,所以会产生两条日志,查看日志的时候忽略内核日志即可。

  • 暂无评论
年代过于久远,无法发表回答
×
🔝