简体   繁体   English

Laravel 8.0 看不到滚动条

[英]Rollbar is not seen by Laravel 8.0

I have installed the Rollbar 7.0 into Laravel 8.0.我已经将 Rollbar 7.0 安装到 Laravel 8.0 中。 PHP version is 7.4 I am trying to send a test exception message using a simple Console command but that sends me nothing. PHP 版本是 7.4 我正在尝试使用简单的控制台命令发送测试异常消息,但没有发送任何内容。 My configs are the following: config/app.php:我的配置如下:config/app.php:

return [
    'providers' => [
        Rollbar\Laravel\RollbarServiceProvider::class
    ...
]

config/logging.php:配置/logging.php:

 'channels' => [
        'stack' => [
            'driver' => 'stack',
            'channels' => ['other', 'rollbar'],
            'ignore_exceptions' => false,
        ],
        'rollbar' => [
            'driver' => 'monolog',
            'handler' => MonologHandler::class,
            'access_token' => env('ROLLBAR_TOKEN'),
            'level' => env('ROLLBAR_LEVEL'),
            'enabled' => true,
            'environment' => env('ROLLBAR_ENVIRONMENT'),
        ]
        ....

config/services.php (but seems to be that it doesn't work) config/services.php(但似乎它不起作用)

    'rollbar' => [
        'access_token' => env('ROLLBAR_TOKEN'),
        'environment' => env('ROLLBAR_ENVIRONMENT'),
        'level' => env('ROLLBAR_LEVEL')
    ],

app.env:应用程序.env:

ROLLBAR_TOKEN=real_token
ROLLBAR_LEVEL=debug
ROLLBAR_ENVIRONMENT=backend_test

And the console command itself has the following view:控制台命令本身具有以下视图:

public function handle()
{
//    Rollbar::init([
//        'driver' => 'monolog',
//        'handler' => MonologHandler::class,
//        'access_token' => env('ROLLBAR_TOKEN'),
//        'level' => env('ROLLBAR_LEVEL'),
//        'enabled' => true,
//        'environment' => env('ROLLBAR_ENVIRONMENT'),
//    ]);
    try{
        $x = 4/0;
        } catch(\Exception $exception) {
            Rollbar::error('caught demo exception', ["details" => $exception->getMessage()]));
            Rollbar::flush();
            exit(1);
    }
}

So when it is like this, the rollbar stays silent.所以当它是这样时,滚动条保持沉默。 But if I uncomment the initialisation, that works well, sending a debug message to the rollbar.但是,如果我取消对初始化的注释,效果很好,会向滚动条发送调试消息。

That doesn't work all over the project too.这也不适用于整个项目。

Could you please advice me, what could I do here in order to make it work globally with initialising in every file?您能否给我建议,我可以在这里做些什么才能使其在每个文件中初始化时在全局范围内工作?

upd: I've also cleared config cache and tried to make a rollbar as a default upd:我还清除了配置缓存并尝试将滚动条设为默认值

Laravel in app/logging.php has a default channel configuration. app/logging.php 中的 Laravel 有一个默认的频道配置。 Normally "default" should mean that there are some other working channel too but here, somehow it the meaning is like "the only used channel".通常“默认”应该意味着还有其他一些工作频道,但在这里,不知何故它的意思就像“唯一使用的频道”。 Or I just do not fully understand how should it work.或者我只是不完全理解它应该如何工作。 So my rollbar channel seems to be overriden by the another "default" one, that is why the system doesn't use it.所以我的滚动条频道似乎被另一个“默认”频道覆盖,这就是系统不使用它的原因。 So the solution is to switch the default channel:所以解决办法是切换默认频道:

    'default' => env('LOG_CHANNEL', 'stack'),

when the rollbar is included to stack channel or just当滚动条包含在堆栈通道中或仅包含在

    'default' => env('LOG_CHANNEL', 'rollbar'),

when it is not.当它不是。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM