laravel-request-logger icon indicating copy to clipboard operation
laravel-request-logger copied to clipboard

App::abort - response and request does not get logged - Laravel 5

Open mrwaim opened this issue 10 years ago • 0 comments
trafficstars

I created a simple route

Route::get('/error', function () { abort(404, 'My Error Page'); });

When I hit the route, nothing gets logged.

Here is the binding LoggerServiceProvider.php app('router')->after('Prettus\RequestLogger\Filters\ResponseLogger');

ResponseLogger.php public function filter(Request $request, Response $response)

filter function is never called.

I see two ways of catching errors in laravel - http://laravel.com/docs/master/errors#handling-errors as well as http://laravel.com/docs/master/middleware#terminable-middleware

The first one, I dont know, and doubt, that the request/response information will be available.

The second one looks promising, however, http://laravel.com/api/5.0/Illuminate/Routing/Router.html doesnt expose a "terminate()" method, it only exposes middlewhere.

Its fairly important for me, to have logs that include error results.

Thanks for taking a look!

mrwaim avatar May 26 '15 00:05 mrwaim