5

When calling (Illuminate\Support\Facades\)Log::error I can only see the message on Bugsnag but not the contextual information. Is there a way I can set-up Laravel/Bugsnag to also pass context?

For example, when doing Log::error("Exception occurred.", ["Further info here."]); only the message ("Exception occurred.") is displayed on Bugsnag.

geca
  • 2,711
  • 2
  • 17
  • 26
  • 1
    Bugsnag certainly supports adding additional data to these events. I don't know anything about Laravel, or even PHP, but whenever you're reporting handled exceptions like this, you can supply any amount of metadata: see https://docs.bugsnag.com/platforms/php/laravel/reporting-handled-errors/ for more information. – kinbiko Jun 01 '18 at 15:49

1 Answers1

6

When you call Log::error the logged message and context are parsed by the Bugsnag PSR Logger. The uses the context in a few ways:

  1. Extracts a title from the context array if set. This title will then become the context in which your error is displayed on the Bugsnag dashboard.
  2. Extracts an exception from the context array if set. This exception will then be used to create the error report and stacktraces.
  3. Attaches the remaining context to the report as metadata. If the context array contains sub-arrays they will be displayed on separate tabs, if not the information will be displayed in a custom tab in the error on the Bugsnag dashboard.

In your case, I would check out the custom metadata tab on your error and see if your context has turned up there.

A.Moinet
  • 76
  • 3