Laravel log all database queries with their bindings and execution time in seconds
This is done by using the boot method in app/Providers/AppServiceProvider.php
public function boot()
{
DB::listen(function ($query) {
Log::info(
$query->sql,
[
'bindings' => $query->bindings,
'time' => $query->time
]
);
});
}This logs as info with the query, its bindings and the execution time.