Commit 4bf3b024 by lujunyi

请求日志

parent cc9e5a72
......@@ -21,6 +21,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\Spatie\HttpLogger\Middlewares\HttpLogger::class,
];
/**
......
......@@ -23,6 +23,7 @@
"overtrue/pinyin": "^5.3",
"predis/predis": "^2.2",
"sparkinzy/dcat-viewer": "^1.0",
"spatie/laravel-http-logger": "^1.11",
"tymon/jwt-auth": "^2.1"
},
"require-dev": {
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "07135fceb49742bf4ca446a83fb77bc0",
"content-hash": "49823373b75af40f543b069d0d73c169",
"packages": [
{
"name": "box/spout",
......@@ -5119,6 +5119,72 @@
"time": "2024-06-04T11:09:54+00:00"
},
{
"name": "spatie/laravel-http-logger",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-http-logger.git",
"reference": "96c18c32999e2e4142e157a71f51d467da29fa98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-http-logger/zipball/96c18c32999e2e4142e157a71f51d467da29fa98",
"reference": "96c18c32999e2e4142e157a71f51d467da29fa98",
"shasum": ""
},
"require": {
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
"php": "^7.4|^8.0"
},
"require-dev": {
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
"pestphp/pest": "^1.22|^2.34",
"phpunit/phpunit": "^9.0|^10.5"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\HttpLogger\\HttpLoggerServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Spatie\\HttpLogger\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brent Roose",
"email": "brent@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "A Laravel package to log HTTP requests",
"homepage": "https://github.com/spatie/laravel-http-logger",
"keywords": [
"laravel-http-logger",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/laravel-http-logger/issues",
"source": "https://github.com/spatie/laravel-http-logger/tree/1.11.0"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
}
],
"time": "2024-03-02T05:42:55+00:00"
},
{
"name": "spatie/laravel-package-tools",
"version": "1.16.6",
"source": {
......
<?php
return [
/*
* Determine if the http-logger middleware should be enabled.
*/
'enabled' => env('HTTP_LOGGER_ENABLED', true),
/*
* 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,
/*
* The log channel used to write the request.
*/
'log_channel' => env('HTTP_LOGGER__CHANNEL', 'http_logger_daily'),
/*
* The log level used to log the request.
*/
'log_level' => 'info',
/*
* Filter out body fields which will never be logged.
*/
'except' => [
'password',
'password_confirmation',
],
/*
* List of headers that will be sanitized. For example Authorization, Cookie, Set-Cookie...
*/
'sanitize_headers' => [],
];
......@@ -126,6 +126,22 @@
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
'sql_query_daily' => [
'driver' => 'daily',
'path' => storage_path('logs/sql.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
'replace_placeholders' => true,
],
'http_logger_daily' => [
'driver' => 'daily',
'path' => storage_path('logs/http.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
'replace_placeholders' => true,
],
],
'query' => [
......@@ -140,6 +156,6 @@
'trigger' => env('QUERY_LOG_TRIGGER'),
// Log Channel
'channel' => 'stack',
'channel' => 'sql_query_daily',
],
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment