dailysleaze's avatar

Listening to Exceptions

In L4 I used this gist to copy the logs to a database table: https://gist.github.com/conradkleinespel/5476977 It now works via AppServiceProvider.

However, it doesn't now work for Exceptions.

Doing some dd() in Illuminate\Log\Writer, the listen() function is called, but fireLogEvent() doesn't seem to be called in L5.1 when there is an Exception https://github.com/laravel/framework/blob/5.1/src/Illuminate/Log/Writer.php#L289-L297

I don't know if that's because the Exception happens and a response is returned before fireLogEvent() gets called, or whether this is a change/bug in L5 that is right/wrong?

0 likes
2 replies
jrean's avatar

@dailysleaze app\Exceptions\Handler.php is the place to work with if I correctly understood your post.

Your gist link leads to 404.

dailysleaze's avatar

Thanks. I updated the link.

I could manually log in the Handler, but I would presume that because Laravel writes to the Log when there is an Exception, that I could just hook into that like in L4.

Using Handler will be my fallback :)

Please or to participate in this conversation.