Composer
Add prettus/laravel-request-logger to the "require" section of your
composer.json file.
"prettus/laravel-request-logger": "1.0.*" Run composer update to get the latest version of the package.
or Run
composer require prettus/laravel-request-logger
direct in your terminal
Laravel
In your config/app.php add
'Prettus\RequestLogger\Providers\LoggerServiceProvider' to the end of
the providers array:
'providers' => array(
...,
'Prettus\RequestLogger\Providers\LoggerServiceProvider', ),
Publish Configuration
php artisan vendor:publish --provider="Prettus\RequestLogger\Providers\LoggerServiceProvider" Configuration
In your config/request-logger.php
file, you can change configuration
for logger
'logger' => [
'enabled' => true,
'handlers' => ['Prettus\RequestLogger\Handler\HttpLoggerHandler'],
'file' => storage_path("logs/http.log"),
'level' => 'info',
'format' => 'common' ]
{方法} {完整的URL}
[2015-04-03 00:00:00] local.INFO: GET
http://prettus.local/user/1?param=lorem ["请求"] {方法}
{完整的URL} {远程地址} {端口号}
[2015-04-03 00:00:00] local.INFO: GET
http://prettus.local/user/1?param=lorem 192.168.10.1 80 ["请求"]
{方法} {根目录} {URL} {完整的URL} {路径} {解码后的路径} {远程地址}
{格式} {协议} {端口号} {查询字符串}
[2015-04-03 00:00:00] local.INFO: GET http://prettus.local
http://prettus.local/user/1 http://prettus.local/user/1?param=lorem
user/1 user/1 192.168.10.1 html http 80 param=lorem ["请求"]
[{状态}] HTTP:{HTTP版本号} {内容}
[2015-04-03 00:00:00] local.INFO: [200] HTTP:1.1
{"id":1,"name":"Anderson Andrade", "email":"contato@andersonandra.de"}
["响应"]