Log HTTP requests in a Laravel application
This package adds a middleware which can log incoming requests to the default log. If anything goes wrong during a user's request, you'll still be able to access the original request data sent by that user.
Installation
You can install the package via composer:
composer require spatie/laravel-http-logger
Optionally you can publish the configfile with:
php artisan vendor:publish --provider="Spatie\HttpLogger\HttpLoggerServiceProvider" --tag="config"
This is the contents of the published config file:
return [
/*
* The log profile which determines whether a request should be logged.
* It should implement `LogProfile`.
*/
'log_profile' => \Spatie\HttpLogger\LogNonGetRequests::class,
/*
* The log writer used to write the request to a log.
* It should implement `LogWriter`.
*/
'log_writer' => \Spatie\HttpLogger\DefaultLogWriter::class,
/*
* Filter out body fields which will never be logged.
*/
'except' => [
'password',
'password_confirmation',
],
];
Link:
This post is submitted by our members. Submit a new post.
Tags: Tutorials Laravel 5.4 Laravel 5.5 Laravel 5.3 Intermediate