rollbar / rollbar-php-laravel

Rollbar error monitoring integration for Laravel projects
https://docs.rollbar.com/docs/laravel
140 stars 39 forks source link

Rollbar-PHP-Laravel not built and Logger object not created #62

Closed ajtran closed 6 years ago

ajtran commented 6 years ago

internal: https://app.intercom.io/a/apps/rlisg82q/inbox/inbox/849049/conversations/18362269083

User encountered this trouble while settings up:

"RollbarLogger::class is registered as a singleton...

$this->app->singleton(RollbarLogger::class, function ($app) {
...
this code is never run
...
});

so it never actually build the config and create the actual logger object

the RollbarServiceProvider registers the RollbarLogger by providing a closure

But this closure is never executed because the RollbarLogger class is never requested anywhere in the code

adding this in the controller

public function index(RollbarLogger $rollbarLogger)
{
$rollbarLogger->error('something');
return view('home');
}

forces the RollbarLogger clousure to be evaluated and thus works"

so i was wondering if this is something that is missing from the documentation or something with the SDK.

ajtran commented 6 years ago

another option -

"instead of putting it in the controller, add a custom service provider with boot(\Rollbar\RollbarLogger $rollbarLogger) and nothing else in it"

ArturMoczulski commented 6 years ago

From the internal conversation it seems like the user is using Laravel 5.5 but following the setup steps for 5.6. config/logging.php is not used on Laravel 5.5

ArturMoczulski commented 6 years ago

Also the tmp log file is not being used anymore. I think it would be the best to get the user on call and go exactly through his setup. @ajtran do you think we can arrange that?

ajtran commented 6 years ago

@ArturMoczulski Hm. Let me see if I can get in contact with the user. I think there are other users that have been facing similar issues to this tho. I'll send them this way if it does come up again.

jessewgibbs commented 6 years ago

I'm closing this since there's been no response from the reporter.