From 09457a3f11e9885ad17e9de871e06003472a16cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=99=E5=AD=A6=E6=9D=B0?= Date: Thu, 3 May 2018 17:58:02 +0800 Subject: [PATCH] add request id --- src/Listeners/QueryListener.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Listeners/QueryListener.php b/src/Listeners/QueryListener.php index 27c2920..82d2300 100644 --- a/src/Listeners/QueryListener.php +++ b/src/Listeners/QueryListener.php @@ -37,7 +37,9 @@ class QueryListener if (env('APP_DEBUG')) { $sql = str_replace("?", "'%s'", $event->sql); $log = vsprintf($sql, $event->bindings); - $this->logger->info($log.';', ['conn' => $event->connectionName, 'time' => $event->time.'ms']); + $requestId = app('request')->header('x-request-id'); + $text = "$requestId\t$log\t"; + $this->logger->debug($text, ['conn' => $event->connectionName, 'time' => $event->time.'ms']); } }